I came up with a pseudo code but i couldn't figure out how to start i dove in. This is my first programming class. I came up with a rough draft but it won't keep track of the answers given
Code:
#include <iostream>
using namespace std;
int main()
{
//Variables defined for drink choices
int COFFEE = 0,
TEA = 0,
COKE= 0,
OJ = 0;
int exit;
int people;
int num=1;
int choice;
int totalC=0,
totalT=0,
totalCk=0,
totalO=0;
//finding the number of time the questions will be asked
cout<<"How many people will be taking this survey?\n";
cin>>people;
//menu for beverage choices
while(num<=people)
{
cout<<"Favorite Beverage Choices\n1.Coffee\n2.Tea\n3.Coke\n4.OJ\n-1 to exit the program\n\n";
cout<<"Please input favorite beverage of person #"<<num<<endl;
cout<< "Press 1,2,3, or 4 from the above menu. Press -1 to exit.\n\n";
cin>>choice;
num++;
}
//switch to tally up the choices to be displayed at the end
switch(choice)
{
case '1': (totalC++);
break;
case'2': (totalT++);
break;
case'3': (totalCk++);
break;
case '4': (totalO++);
break;
default: cout<< "Invalid selection\n";
break;
}
//display of total picks
cout<<"The number of people surveyed is "<<people<<".\n\n";
cout<<"Beverage Vote List\n";
cout<<"*********************************\n";
cout<<"Coffee:"<<totalC<<endl;
cout<<"Tea:"<<totalT<<endl;
cout<<"Coke:"<<totalCk<<endl;
cout<<"Orange Juice:"<<totalO<<endl;
return 0;
}