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




Saturday, May 26, 2012

C++ - LOOPING WITH FOR

Hi friends.. welcome again in my site..."We Are Knowledge"... in here you want getting many IT knowledge, like dekstop programing of "C++", that I will give.

Ok.. let's do read my article

In C++ programing to be found 2(two) kinds looping...
1. IF >> IF THEN >> IF THEN ELSE
2. SWITCH
But, I want to explain with IF

IF in C++ is command for choice one from many choice. Program want choice accordance with the values ​​held. and IF the statement is "true" then getting frist option, and IF "else" getting other option. Or you can too using IF ELSE IF ELSE, is nested if, this command too often many programmers in making program

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

Copy this program then paste in your software likely borland or turbo:


#include <iostream>
#include <conio.h>
main()
{
int a;
cout << "   ***MENU OF 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;
if (a==1)
{
cout << "YOU ARE CHOICE NASI GORENG" << endl;
cout << "FEE Rp. 8.000" << endl;
cout << "THANKS,.. PLEASE WAIT";
getch();
}
if (a==2)
{
cout << "YOU ARE CHOICE NASI RAMES" << endl;
cout << "FEE Rp. 7.000" << endl;
cout << "THANKS,.. PLEASE WAIT";
getch();
}
if (a==3)
{
cout << "YOU ARE CHOICE NASI UDUK" << endl;
cout << "FEE Rp. 5.000" << endl;
cout << "THANKS,.. PLEASE WAIT";
getch();
}
}
getch();


And  result :



Then press
  •       ALT    +F9     >> compiling program
  •       CTRL + F9    >> execution program

And output like this…



Ok. just it...
I hope you understand with my tutorial...

thsnk visitors and readers..
see you later

No comments:

Post a Comment