How I can create program in C# with the help of "if statement" like a utility store ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I can create program in C# with the help of "if statement" like a utility store ?

e.g 1 . biscuits, 2 . chips, 3 . chocolates and press 1 show the items biscuit .

2nd Jan 2017, 12:45 PM
Rasool Bux
Rasool Bux - avatar
7 Answers
+ 1
Ok here, an example. Int choice ; Cout<<'' please make your choice ''<<endl<< "1. Biscuits"<<endl<<"2. Chocolate"<<endl; Cin>>choice; If(choice==1){ Cout<<"biscuit"<<endl; } else if(choice==2){ Cout<<"chocolate"<<endl; } else{ Cout<<"you entered wrong choice"<<endl; }
2nd Jan 2017, 11:22 PM
shaufyq sone
shaufyq sone - avatar
0
I more recommend you use switch case. Better performance.
2nd Jan 2017, 1:17 PM
shaufyq sone
shaufyq sone - avatar
0
yeah I know dear but I can make with the help of if statement please help me ..... @shaufyqsone
2nd Jan 2017, 1:59 PM
Rasool Bux
Rasool Bux - avatar
0
Okay thanks dear I was created program yesterday in c# with myself ;) but thanks you so much you help me . @shaufyqsone
3rd Jan 2017, 7:04 PM
Rasool Bux
Rasool Bux - avatar
0
Okay thanks dear I was created program yesterday in c# with myself ;) but thanks you so much you help me . @shaufyqsone
3rd Jan 2017, 7:04 PM
Rasool Bux
Rasool Bux - avatar
0
Welcome, I'm too still in learning. 😁
3rd Jan 2017, 11:26 PM
shaufyq sone
shaufyq sone - avatar
0
hahahahahaha......... @shaufyqsone
4th Jan 2017, 4:04 PM
Rasool Bux
Rasool Bux - avatar