#include<iostream>
usingnamespace std;
char ch;
int main(){
cout<<"Hello!Which beverage do you want?\n";
cout<<"1.cola 2.pepsi 3.coke 4.beverage 5.water\n";
cin>>ch;
ch=30;
cout<<"\n";
switch(ch){
case'1':
cout<<"Here is your cola!";
break;
case'2':
cout<<"Here is your pepsi!";
break;
case'3':
cout<<"Here is your coke!";
break;
case'4':
cout<<"Here is your beverage!";
break;
case'5':
cout<<"Here is your water!";
break;
}
}
i've tried removing "break"s but it doesn' work!
Need help!
#include<iostream>
usingnamespace std;
int main(){
cout<<"Hello! Which beverage do you want?" << endl;
cout<< "1.cola 2.pepsi 3.coke 4.beverage 5.water" << endl;
int choice;
cin >> choice;
switch(choice){
case 1:
cout<<"Here is your cola!";
break;
case 2:
cout<<"Here is your pepsi!";
break;
case 3:
cout<<"Here is your coke!";
break;
case 4:
cout<<"Here is your beverage!";
break;
case 5:
cout<<"Here is your water!";
break;
}
}