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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(void)
{
cout << " Personality Test Concept\n" << endl;
system("PAUSE");
string answer1,answer2,answer3,answer4,answer5;
bool valid = false;
do {
system("CLS");
cout << "Question 1\n\n";
cout << "You love hangout?\n";
cout << "A.Yes I do.\nB.Sometimes.\nC.Rarely\nD.No\n\n";
cout << "Answer: ";
cin >> answer1;
valid = false;
if (answer1 == "A" || answer1 == "a" ){
valid = true;
}
else if (answer1 == "B" || answer1 == "b"){
valid = true;
}
else if (answer1 == "C" || answer1 == "c"){
valid = true;
}
else if (answer1 == "D" || answer1 == "d"){
valid = true;
}
else {
cout << "That is an invalid answer!\n\n"
<< "Please type only A,a,B,b,C,c and D,d.\n";
system("PAUSE");
}
} while (!valid);
do {
system("CLS");
cout << "Question 2\n\n";
cout << "2.Do you like fish?\n";
cout << "A .Yes eat alot.\nB.sometime eat\nC.Everytime I eat fish\nD.no thank\n\n";
cout << "Answer: ";
cin >> answer1;
valid = false;
if (answer1 == "A" || answer1 == "a" ){
valid = true;
}
else if (answer1 == "B" || answer1 == "b"){
valid = true;
}
else if (answer1 == "C" || answer1 == "c"){
valid = true;
}
else if (answer1 == "D" || answer1 == "d"){
valid = true;
}
else {
cout << "That is an invalid answer!\n\n"
<< "Please type only A,a,B,b,C,c and D,d.\n";
system("PAUSE");
}
} while (!valid);
}
|