1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#include <string>
#include <iostream>
using namespace std;
int main ()
{
string choice,Q,answer1,answer2,answer3;
float one=0,two=0,three=0;
cout << "\t" << "Enter your Question: " << "\n";
getline (cin,Q,'\n');
cout << "\t" << "Enter your first answer: " << "\n";
getline (cin,answer1,'\n');
cout << "\t" << "Enter your second answer: " << "\n";
getline (cin,answer2,'\n');
cout << "\t" << "Enter your third answer: " << "\n";
getline (cin,answer3,'\n');
do
{
cout << "\n" << Q << "\n""\n";
cout << "1 - " << answer1 << "\n";
cout << "2 - " << answer2 << "\n";
cout << "3 - " << answer3 << "\n";
cout << "0 - Press to exit" << "\n";
getline(cin,choice,'\n');
if(choice == "1"){
one++;
}
else if(choice == "2"){
two++;
}
else if(choice == "3"){
three++;
}
else if(choice == "0"){
}
else
{
cout << "\t" "\t"<< "nevybrali ste platnu hodnotu!!!" << "\n""\n";
}
} while (choice != "0");{
cout << "\n";
cout << " 1: " << one << " answers" << " - " << one*100/(one+two+three) << "%" << "\t""\t";
cout << " 2: " << two << " answers"<<" - " << two*100/(one+two+three) << "%" << "\t""\t";
cout << " 3: " << three << " answers" <<" - " << three*100/(one+two+three) << "%" << "\t""\t""\n""\n";
}
}
|