• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Saturday, May 26, 2012

C++ - LOOPING WITH SWITCH


Hi... Hi.... Hi.... Welcome to my blog in "We Are Knowledge"... in here you will getting many IT knowledge, likely This article discusses the program language "C++"... and  tutorial of "switch case"..

I want make looping program with for using “BORLAND”.  And if you only have “TURBO C”, you can too using for make looping program

Copy this program then paste in your software :


Example 1:

#include <iostream>
#include <conio.h>
main()
{
int a;
cout << "   ***MENU OF INDONESIAN FOODS***" << endl << endl;
cout << " 1. NASI GORENG Rp. 8.000" << endl;
cout << " 2. NASI RAMES  RP. 7.000" << endl;
cout << " 3. NASI UDUK   Rp. 5.000" << endl << endl;
cout << " NUMBER ORDER : ";
cin >> a;
switch (a)
{
Case 1:
{
cout << "THE INDONESIAN " << endl;
cout << "YOU ARE CHOICE NASI GORENG" << endl;
cout << "FEE Rp. 8.000" << endl;
cout << "THANKS,.. PLEASE WAIT";
break;
}
Case : 2
{
cout << "THE INDONESIAN " << endl;

cout << "YOU ARE CHOICE NASI RAMES" << endl;
cout << "FEE Rp. 7.000" << endl;
cout << "THANKS,.. PLEASE WAIT";
break;
}
Case 3:
{
cout << "THE INDONESIAN " << endl;
cout << "YOU ARE CHOICE NASI UDUK" << endl;
cout << "FEE Rp. 5.000" << endl;
cout << "THANKS,.. PLEASE WAIT";
break;
}
}
getch();
}



Note ::

Please you must do it, that is change all quotes.
If you using notepad, save with save as type =  cpp. Examle “case.cpp” and for running using turbo c or borland.
Press the button in keyboard”alt  + F9” >> compile the program
Press the button in keyboard”ctrl + F9” >> running the program


To result :

If your input number 1 :

THE INDONESIAN
YOU ARE CHOICE NASI GORENG
FEE Rp. 8.000
THANKS,.. PLEASE WAIT"


And let’s do input other number….



OK.. just it..
I hope you like this..
See you later

No comments:

Post a Comment