Saturday, September 23, 2006

A Simple Program

#include (iostream)
using namespace std;

int main(){
int choice, count = 0;
int choice1 = 1, choice2 = 2,choice3 = 3, choice4 = 4, choice5 = 5;

cout << "Who do you think is the most handsome among the four of us?" << endl << endl;
cout << "(1) Benny" << endl;
cout << "(2) Keng Lim" << endl;
cout << "(3) Junli" << endl;
cout << "(4) Shih Kwang" << endl;
cout << "(5) All of the above" << endl << endl;
cout << "Please key in the number of one of the choices:" << endl;

do{
cin >> choice;
if(choice == choice1 ll choice == choice2 ll choice == choice3 ll choice == choice4 ll choice == choice5){
count = 0;
if(choice == choice1){
cout << "Are you sure or not?" << endl;
cout << "Please key in another choice." << endl;
}
if(choice == choice2){
cout << "Don't try to bluff us?" << endl;
cout << "Please key in another choice." << endl;
}
if(choice == choice3){
cout << "Can you don't be so frank?" << endl;
cout << "Please key in another choice." << endl;
}
if(choice == choice4){
cout << "Are you hwee hwee?" << endl;
cout << "Please key in another choice." << endl;
}
if(choice == choice5){
cout << "Thank you for your frankness in the above question." << endl;
count++;
}
}
else{
cout << "Don't try anything funny." << endl;
cout << "Please key in another choice." << endl;
}
}while(count == 0);

system("pause");
return 0;
}

Sample Output:

Who do you think is the most handsome among the four of us?

(1) Benny
(2) Keng Lim
(3) Junli
(4) Shih Kwang
(5) All of the above

Please key in the number of one of the choices:
1
Are you sure or not?
Please key in another choice.
2
Don't try to bluff us?
Please key in another choice.
3
Can you don't be so frank?
Please key in another choice.
4
Are you hwee hwee?
Please key in another choice.
0
Don't try anything funny.
Please key in another choice.
5
Thank you for your frankness in the above question.
Press any key to continue . . .

0 Comments:

Post a Comment

<< Home