From: Bram de Greve Newsgroups: comp.os.msdos.djgpp Subject: Newbie on the 'switch' Date: Sat, 21 Aug 1999 19:35:23 -0700 Organization: University of Ghent, Belgium Lines: 66 Message-ID: <37BF61EB.2DD26DC0@rug.ac.be> NNTP-Posting-Host: sdln1p17.rug.ac.be Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------AED26BC7673CE1CF2C8F683A" X-Mailer: Mozilla 4.04 [en] (Win16; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com --------------AED26BC7673CE1CF2C8F683A Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: Select Case Choice Case 0, 1: Print "This is one thing." Case 2 : Print "This is another thing." Case Else: Print "Default!" End Select Tanks in advance, Bram --------------AED26BC7673CE1CF2C8F683A Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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:

Select Case Choice
   Case 0, 1: Print "This is one thing."
   Case 2   : Print "This is another thing."
   Case Else: Print "Default!"
End Select

Tanks in advance,
Bram
  --------------AED26BC7673CE1CF2C8F683A--