Original Post
Why is this not working? I wan it where you enter a two numbers and it divides them then * 100. Like this
Points possible: 80
Points earned: 40
Total score: %50
But it just puts out the first number. Heres the code:
Anyone know why?
cout << "Lesson/Test name: ";
cin.getline(lname, 60);
cout << "Points possible: ";
cin.getline(pts1, 8);
ofstream file_01("num1.txt");
file_01 << pts1;
file_01.close();
Sleep(400);
ifstream file_02("num1.txt");
file_02 >> grade1;
file_02.close();
cout << "Points Earned: ";
cin.getline(pts2, 8);
ofstream file_03("num1.txt");
file_03 << pts2;
file_03.close();
ifstream file_04("num1.txt");
file_04 >> grade2;
file_04.close();
int fgrade = grade1;
int fgrade2 = grade2;
int fgrade3 = 100;
int fgrade4 = (fgrade2 / fgrade) * fgrade3;
cout << "Your grade average is: " << fgrade << endl;