#include <iostream>
usingnamespace std;
int main()
{
int i,players,vote,totalwii,totalxbox,totalplay = 0;
cout << "Welcome to the game console survey" << endl;
cout << "Enter the total number of participants: ";
cin >> players;
cout << "THe available consoles are: ";
cout << "\n1. Nintentdo Wii";
cout << "\n2. Microsoft X-box one";
cout << "\n3. Sony Playstation 4" << endl;
cout << "\nIf you prefer Nintendo Wii, enter 1.";
cout << "\nIf you prefer Microsoft X-box one, enter 2.";
cout << "\nIf you prefer Sony Playstation 4, enter 3." << endl;
for (i=0 ; i < players ; i++)
{
cout << "\nParticipant #" << (i+1) << ", Enter your favourite game console choice: ";
cin >> vote;
if (vote = 1)
{
totalwii++;
}
elseif (vote = 2)
{
totalxbox++;
}
elseif (vote = 3)
{
totalplay++;
}
}
cout << "Results of the survey ------------------->" << endl;
cout << totalwii << endl;
return 0;
}
Alright I've done that now. I've also carried on with more of my code because I need to have a 1st, 2nd and 3rd scale after the survey is done including ties. I'm getting a compiler error and I'm not sure why.
Wow, I feel dumb now. I've changed it but I'm still getting an expected identifier before '(' token error. What is causing that? Thanks for you help so far by the way :)
I've done that and it compiles but the program doesnt recognise a tie or winners or anything. It's not working as intended but it looks like it should.