this was the only coding exercise that I've had trouble with so far on this great learning adventure :)
just looking to see if there was a better way to do this, or if any tips could be thrown my way. the program runs well.
cheers
Code:#include <iostream>
#include <string>
using namespace std;
int main (){
int answer;
int obama = 0;
int romney = 0;
int option3 = 0;
while (obama < 5 && romney < 5 && option3 < 5)
{
cout<< " who would you like to see become president?\n";
cout<< "1. obama\n2. romney\n3. The bank owns the government.\n";
cin>> answer;
if (answer == 1){
obama++;
}
else if (answer == 2){
romney++;
}
else if (answer == 3){
option3++;
}
else {
cout<< "please enter a number 1-3\n";
}
}
cout<< "obama- " << obama << "\n";
cout<< "romney- " << romney << "\n";
cout<< "doesn't matter- " << option3 << endl;
cin.ignore ();
cin.get ();
}