#include <iostream>#include <cstdlib>#include <ctime>using namespace std;int main(){ srand(time(0)); int aop; //This will hold the # amount of how many problems the user wants cout<<" Welcome to the Math Quizzer!\n\n\n\n"; cout<<" First, please enter the number of problems you wish to have: "; cin>>aop; //Waits for user input of # of problems cin.get(); cout<<"\n\n\n"; //Arrays which each problem will be stored in: int aarr[aop-1]; int barr[aop-1]; //Arrays for supplied answers and correct answers: int answers[aop-1]; int crrans[aop-1]; //crrans=correct answers //Now loops spitting out random problems. Loop amount=aop (amount of problems) for(int i=0;i<aop;i++){ int a=rand()%100; //Gives a a random value between 0 and 100 int b=rand()%100; //Gives b a random value between 0 and 100 int ca=a+b; //ca=correct answer; stores the correct answer to the problem int answ; //answ=answer; will store the given answer //Puts a and b in the arrays (respectfully): aarr[i]=a; barr[i]=b; crrans[i]=ca; //Puts the correct answer in the crrans array cout<<"\n\n What is "<<a<<"+"<<b<<"?\n Answer: "; cin>>answ; cin.get(); answers[i]=answ; //Puts the given answer in the answers array } cout<<"\n\n\n Your results:\n\n"; int score=0; //Loop which outputs results: for(int r=0;r<aop;r++){ cout<<" Problem: "<<aarr[r]<<"+"<<barr[r]<<" Correct Answer: "<<crrans[r]<<" Your Answer: "<<answers[r]<<" Therefore: "; //Checks to see whether the given answer was correct or incorrect: if(crrans[r]==answers[r]){ cout<<" Correct!\n"; score++; }else{ cout<<" Incorrect!\n"; } } float percent=(score/aop)*100; cout<<"\n\n\n Your Score: "<<percent<<"%\n"; cin.get();}