From: mhaley99 AT homemail DOT com (Matthew Haley) Newsgroups: comp.os.msdos.djgpp Subject: Re: Newbie on the 'switch' Organization: Home Message-ID: <37beedf2.15132094@news.uswest.net> References: <37BF61EB DOT 2DD26DC0 AT rug DOT ac DOT be> X-Newsreader: Forte Free Agent 1.11/32.235 Lines: 38 Date: Sat, 21 Aug 1999 18:23:31 GMT NNTP-Posting-Host: 209.181.104.27 X-Trace: news.uswest.net 935259784 209.181.104.27 (Sat, 21 Aug 1999 13:23:04 CDT) NNTP-Posting-Date: Sat, 21 Aug 1999 13:23:04 CDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Try: switch (choice) { case 0: case 1: cout << "This is 0 and 1." << endl; break; case 2: cout << "This is 2." << endl; break; default: cout << "This is default." << endl; break; } By the way, please don't post HTML :) On Sat, 21 Aug 1999 19:35:23 -0700, Bram de Greve wrote: >Hi, > >when you use switch like this: > >switch (choice) >{ >case 0: cout << "This is one thing." << endl; > break; >case 1: cout << "This is one thing." << endl; > break; >case 2: cout << "This is another thing." << endl; > break; >default:cout << "Default!" << endl; > >Is there any way to combine case 0 and 1 into one line l, like you >should do in Turbo Pascal or QuickBASIC (sorry :-) and VisualBASIC: