Question
can you help me fix this please!? #include #include #include < string> #include #include #include using namespace std; int main() { int choice = 0;
can you help me fix this please!?
#include
#include
#include< string>
#include
#include
#include
using namespace std;
int main() {
int choice = 0;
int numRight = 0;
int beggMax = 10, beggMin = 0;
int answer;
ifstream inputFile;
string studentName;
cout << "enter your name; ";
std::cin >> studentName;
inputFile.open(studentName);
unsigned seed = time(0);
srand(seed);
do {
cout << "This program helps you to practice math ";
cout << "For addition choose number 1 ";
cout << "For subtraction choose number 2 ";
cout << "For multiplication choose number 3 ";
cout << "For division choose number 4 ";
cin >> choice;
} while (choice < 1 || choice > 4);
if (choice == 1) {
// begginner
cout << "beginning level ";
int sum;
int i = 1;
int totalRightAnswer = 5;
do {
for (; i <= 5; i++) {
int x = (rand() % (beggMax - beggMin + 1)) + beggMin;
int y = (rand() % (beggMax - beggMin + 1)) + beggMin;
cout << x << "+" << y << "= ?" << endl;
sum = x + y;
cin >> answer;
if (answer == sum) {
cout << "correct Answer ";
totalRightAnswer;
}
if (answer != sum)
cout << "wrong answer ";
sum = sum + i;
}
} while (i <= totalRightAnswer);
cout << "congratulation you past this level ";
cout << " intermediate Level ";
// Intermediate
cout << " intermediate Level ";
do {
beggMax = 20;
double x = ((rand() % ((beggMax - beggMin + 1) * 100)) + beggMin) / 100;
double y = ((rand() % ((beggMax - beggMin + 1) * 100)) + beggMin) / 100;
cout << x << "+" << y << "= ?" << endl;
std::cin >> answer;
if (answer == x + y) {
cout << "correct Answer ";
numRight++;
}
else
cout << "wrong answer ";
if (numRight == 10)
cout << "congratulation you past this level ";
cout << " advanced Level ";
} while (numRight > 5 && numRight <= 10);
// advanced
do {
beggMax = 20;
beggMin = -20;
int x = (rand() % (beggMax - beggMin + 1)) + beggMin;
int y = (rand() % (beggMax - beggMin + 1)) + beggMin;
cout << x << "+" << y << "= ?" << endl;
std::cin >> answer;
if (answer == x + y) {
cout << "correct Answer ";
numRight++;
if (numRight == 15)
cout << "congratulation you past this level ";
cout << " you finish all Levels ";
}
else
cout << "wrong ";
} while (numRight <= 15);
}
system("pause");
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started