I am doing a homework assignment for c++. I am able to get my program to run, but I don't know how to modify it for my next assignment. Here is the question.
Modify the program so that various comments are printed for each correct answer and each incorrect answer as follows:
Response to a correct answer:
Very good!
Excellent!
Nice Work!
Keep up the good Work!
Response to an incorrect answer:
No, Please try again
Wrong.. Try once more
Don't give up!
No Keep trying.
User the random number generator to choose from 1-4 to select an appropriate response to each answer. User a switch to issue the response.
I don't know how to do this part: Any help would be great. Here is my code:
// practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
using namespace std;
using std::rand;
using std::srand;
int main()
{
//generates a new random set each time:
int num1;
int num2;
int answer=1;
int compute;
int x=1;
srand ((unsigned)time(0));
while (x==1)
{
num1=rand()%5+1;
num2=rand()%5+1;
compute=num1*num2;
while (answer!=compute)
{
cout<<"How much is"<<num1<<"*"<<num2<<"?"<<endl;
cin>>answer;
if (answer==num1*num2)
cout<<"very good"<<endl;
else
cout<<"No, please try again."<<endl;
}
}
}