Please send a cpp visual studio 2015 file source code and do
Please send a .cpp visual studio 2015 file source code and dont use enhance techneques, just use techneques from till chapter 5 in book c++ from control structures through objects 8th edition.
isbn 13: 978-0-13-376939-5
Write a program to help elementary school students practice their arithmetic skills. Using a loop, the program should display an addition question (containing random numbers[1]), get the student’s answer, and then provide feedback.
This should work as follows:
After a question is displayed, the student will enter an answer. The program checks the student’s answer and provides a feedback message to the student indicating whether the answer was right or wrong. If the student’s answer was wrong, the program should repeat the same question until the student gets it right. If the student’s answer was correct, the program should generate a new question for the student after displaying an appropriate feedback message. The drill continues until the student enters -1 in response to a question.
Numbers in the questions should range from 1...100.
When the student enters -1 the program should display the following statistics before terminating:
Total number of questions asked.
Percentage of questions answered correctly.
NOTE:
Every wrong answer counts toward the percentage. For example, if the kid answers the same question incorrectly 50 times, then that counts as 50 wrong answers.
Do not provide the same feedback message every time after a question. Instead, the program should have a pool of 4 different responses for when the student answers correctly, and another pool of 4 unique responses when the student answers the question incorrectly.
Do not use nested loops in this program. The appropriate structure only requires one loop.
HINTS:
Use a good process when developing this program:
Design it before you build it. Make sure you have the logic worked out (using pseudocode) before you code all of it.
Start immediately and work on it a little every day.
Do not try to implement all of the features of this program at one time. Do a small part, get it working and test it. Only then should you add more code. When testing, it doesn’t mean that you just compile the code, it means run the program and make sure that part works before adding more code! o When you encounter a bug, first figure out why the current version is doing what it is doing. Only then can you identify what code changes you need to make. Do not make code changes until after you have diagnosed the problem.
Note additional requirements below:
Include a “comment box” at the beginning of the program similar to the box shown below.
//=====================================================
// your name
// due date
// Programming Assignment #3
// Description: Math Drill
//=====================================================
Use good programming style in your program. Specifically, this means
Format your code following the same conventions illustrated by the examples in the book. When printed, your code should look good!
Use appropriate indentation (as illustrated in the book) to make the logic obvious.
Comment every variable declaration with a meaningful comment.
Use mnemonic variable names (i.e., names that reflect the purpose of the value the variable will contain).
Programming style is worth 40% of your score on this assignment.
If you have questions, ask me! Do not look at anyone else’s source code. You will not learn this if you do not do it yourself. If you look at someone else’s code, you are cheating. If you cheat, I will follow the cheating policy as given in the syllabus.
Turn in Procedures
Program:
Submit Hardcopy (Printout)
On the due date, turn in a print-out of your source code file, exactly like you have done for previous assignments.
Submit softcopy (source file) to bboard, just like you did for the previous program.
[1] Remember rand() and srand() functions we discussed earlier. Your book has examples of these functions.
| Do not use nested loops in this program. The appropriate structure only requires one loop. |
Solution
//=====================================================
// Shivangi
// due date
// Programming Assignment #3
// Description: Math Drill
//=====================================================
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main ()
{
int numbers[2];
string positive_feedback[4] = {\"correct \" , \"You are going good !\" , \"Proud of you !\" , \"Nice !\"};
string negative_feedback[4] = {\"Work hard !\" , \"Try again !\" , \"Better next time !\" , \"Attempt again !\" };
srand (time(0));
int i = 0; //counter
numbers[0] = rand() % 99 + 1; // load the first random number into numbers[0]
numbers[1] = rand() % 99 + 1; // load the second into numbers[1]
int total_asked = 0;
float correct = 0; // float data type because have to store division
float percent = 0;
int answer;
int RandIndex;
//Ask user to input the correct answer
cout << \"Correctly answer the following or enter -1 to quit: \";
//Initiate checking for correct answer
while (i != -1)
{
cout << \"\ \ \"\"What is \" << numbers[0] << \"+\" << numbers[1] << \"?\" << endl;
cin >> answer;
if (answer == numbers[0] + numbers[1]) // check against the numbers array
{
RandIndex = rand() % 4; //generates a random number between 0 and 3
cout << positive_feedback[RandIndex]<< endl; //Outcome for correct answer
total_asked++ ;
correct++ ;
numbers[0] = rand() % 99 + 1; // load the first random number into numbers[0]
numbers[1] = rand() % 99 + 1; // load the second into numbers[1]
}
else if (answer == -1)
{
break;
}
else //statement for while loop
{
total_asked++ ;
RandIndex = rand() % 4; //generates a random number between 0 and 3
cout << negative_feedback[RandIndex]<< endl; //Outcome for incorrect answer
}
}
percent = (correct / total_asked) * 100;
cout << \"\ Total number of questions asked : \"<<total_asked;
cout << \"\ Percentage of questions answered correctly: \"<< percent << \"%\";
return 0;
}


