hello. im having a problem. this program is supposed to take the specific input from user and then display it. but unfortunately in the last part there is a problem.. it prints all the options.. although it is supposed to print 1... eg taking choice 1 and size 1 and printing only one out put... secondly in the last part when 1 is entered it starts again and when 2 is entered it closes down... thank you
And if i could get the amendments quickly that would be great.. i have to submit it in 8 hours.
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int choice;
int size;
int confirm;
int ending;
cout<<"COLA Machine"<<endl;
cout<<"Welcome\nPlease Choose Your Drink"<<endl;
cout<<"For Coca Cola Press 1"<<endl;
cout<<"For Sprite Press 2"<<endl;
cout<<"For Fanta Press 3"<<endl;
cout<<"For Sprite 3G Press 4"<<endl;
cout<<"For Diet Coke Press 5"<<endl;
cout<<"For Sprite Zero Press 6"<<endl;
cin>>choice;
if (choice == 1)
{
cout<<"You have chosen Coca Cola"<<endl;
}
if (choice == 2)
{
cout<<"You have chosen Sprite"<<endl;
}
if (choice == 3)
{
cout<<"You have chosen Fanta"<<endl;
}
if (choice == 4)
{
cout<<"You have chosen Sprite 3G"<<endl;
}
if (choice == 5)
{
cout<<"You have chosen Diet Coke"<<endl;
}
if (choice == 6)
{
cout<<"You have chosen Sprite Zero"<<endl;
}
cout<<"Please select your Drink Size"<<endl;
cout<<"For 300 ml Bottle Press 1"<<endl;
cout<<"For 330 ml Can Press 2"<<endl;
cout<<"For 500 ml Bottle Press 3"<<endl;
cin>>size;
if (size == 1)
{
cout<<"You have Selected 300 ml Bottle"<<endl;
}
if (size == 2)
{
cout<<"You have Selected 330 ml Can"<<endl;
}
if (size == 3)
{
cout<<"You have Selected 500 ml Bottle"<<endl;
}
if (choice == 1 || size == 1)
{
cout<<"You have chosen 300 ml Bottle of Coca Cola"<<endl;
}
if (choice == 2 || size == 1)
{
cout<<"You have chosen 300 ml Bottle of Sprite"<<endl;
}
if (choice == 3 || size == 1)
{
cout<<"You have chosen 300 ml Bottle of Fanta"<<endl;
}
if (choice == 4 || size == 1)
{
cout<<"You have chosen 300 ml Bottle of Sprite 3G"<<endl;
}
if (choice == 5 || size == 1)
{
cout<<"You have chosen 300 ml Bottle of Diet Coke"<<endl;
}
if (choice == 6 || size == 1)
{
cout<<"You have chosen 300 ml Bottle of Sprite Zero"<<endl;
}
if (choice == 1 || size == 2)
{
cout<<"You have chosen 330 ml Can of Coca Cola"<<endl;
}
if (choice == 2 || size == 2)
{
cout<<"You have chosen 330 ml Can of Sprite"<<endl;
}
if (choice == 3 || size == 2)
{
cout<<"You have chosen 330 ml Can of Fanta"<<endl;
}
if (choice == 4 || size == 2)
{
cout<<"You have chosen 330 ml Can of Sprite 3G"<<endl;
}
if (choice == 5 || size == 2)
{
cout<<"You have chosen 330 ml Can of Diet Coke"<<endl;
}
if (choice == 6 || size == 2)
{
cout<<"You have chosen 330 ml Can of Sprite Zero"<<endl;
}
if (choice == 1 || size == 3)
{
cout<<"You have chosen 500 ml Bottle of Coca Cola"<<endl;
}
if (choice == 2 || size == 3)
{
cout<<"You have chosen 500 ml Bottle of Sprite"<<endl;
}
if (choice == 3 || size == 3)
{
cout<<"You have chosen 500 ml Bottle of Fanta"<<endl;
}
if (choice == 4 || size == 3)
{
cout<<"You have chosen 500 ml Bottle of Sprite 3G"<<endl;
}
if (choice == 5 || size == 3)
{
cout<<"You have chosen 500 ml Bottle of Diet Coke"<<endl;
}
if (choice == 6 || size == 3)
{
cout<<"You have chosen 500 ml Bottle of Sprite Zero"<<endl;
}
cout<<"Do You Want to confirm"<<endl;
cout<<"Press 1 to confirm OR 2 to reset"<<endl;
cin>>confirm;
if (confirm == 1)
{
cout<<"Here is your Drink. Enjoy!"<<endl;
}
if (confirm == 2)
{
cout<<"Do you Want to Reset or Quit\n Press 1 to Reset OR Press 2 to Quit"<<endl;
cin>>ending;
}
if (ending == 1)
{
????????????
}
if (ending == 2)
??????????
return 0;
}