// the expressions should be here
cout<<i<< ".Enter a letter if Left or Right is greater/equal: L E R" << endl; // program's question
cout<< "Q:Quit" << endl; // i is the number of the question that start from 1 to the last number of a right input(l,e,or r)
getline(cin,letter);
if (letter=="l"||letter=="L"||letter=="r"||letter=="R"||letter=="e"||letter=="E") // if the variable letter equals l,L,r,R,e,or E do the next command
{
cout<< "Answer:"<<letter<< endl;
i = i + 1 ; // changing the number of the question to the next number
if (letter=="l"||letter=="L") //counting how many the letter l has been entered
{
n_l = n_l + 1;
}
elseif (letter=="r"||letter=="R") //counting how many the letter r has been entered
{
n_r = n_r+1 ;
}
else //counting how many the letter e has been entered
{
n_e = n_e + 1 ;
}
goto playgame ; // going to the playgame and repeating all the previous steps
}
elseif (letter=="q"||letter=="Q") // print the result and exit from the program
{
cout <<i<<"questions: "<<n_l<<"L "<<n_e<<"E "<<n_r<<"R"<<endl;
cout << "bye" << endl;
goto thestart;
}
else
{
cout <<"Error:Invalid option. Select L-E-R"<<endl;
goto playgame; //going to the beginning of the game and repeating all the previous steps
}
}
}
//***********************//
end:
return 0;
}
The expressions must be evaluated to check the value and be able to evaluate the valide answer to the question. Also those pair of values must be selected randomly.