I made a program that asks 18 questions in a do-while loop and then outputs either "correct" or "wrong" for each question. Is it possible to add a formula that will grade the questions that are answered correctly, like how a regular school test is averaged?
How can I add this to my program? Here's my program:
#include <iostream>
#include <string>
using namespace std;
string answer;
char repeat;
int main()
{
do {
cout<<"Come si dice domani?\n";
cin>>answer;
if (answer=="tomorrow" || answer=="Tomorrow")
cout<<"Correct\n";
else
if(answer!="tomorrow"||"Tomorrow")
cout<<"Sorry"<<endl;
cout<<"Come si dice aqua?\n";
cin>>answer;
if (answer=="water" || answer=="Water")
cout<<"Correct\n";
else if(answer!="water"||"Water")
cout<<"Sorry"<<endl;
cout<<"Come si dice cibo?\n";
cin>>answer;
if (answer=="food" || answer=="Food")
cout<<"Correct\n";
else if(answer!="food"||"Food")
cout<<"Sorry"<<endl;
cout<<"Vuoi giocare di nuovo?";
cin>>repeat;
} while(repeat=='Yes'|| repeat=='yes'||repeat=='si'||repeat=='Si'||repeat=='Y');
return 0;
}