Cant get my program to run

#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

int main ()

{
//input variables
float NumberRight;
float TotalPoints;
float GradePercent;

ifstream inData;

// open file
inData.open ("Grade.in")

// read values
inData >> NumberRight >> TotalPoints;


//calculate values

GradePercent = NumberRight / TotalPoints

cout << "You got a "

if (GradePercent > 90)
{
cout "Excellent" endl;
}

if (GradePercent > 80)
{
cout "Well Done" endl;
}

if (GradePercent > 70)
{
cout "Good" endl;
}
else if (GradePercent >= 60)
{
cout "Need Improvement" endl;
}
else (GradePercent < 50)
{
cout "Fail" endl;
}

return 0;
}


Write a C++ program that computes a student's grade for an assignment as a percentage given the student's score and total points. The final score should be rounded up to the nearest whole values using the ceil function in the <cmath> header file. You should also display the floating -point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by a space. In addition, you should print to the console "Excellent" if the grade is greater than 90, "Well Done" if the grade is greater than 80, "Good" if the grade is greater than 70, "Need Improvement" if the grade is greater than or equal to 60, and "Fail" if the grade is less than 50.
closed account (Dy7SLyTq)
a) code tags
b) whats wrong with it. just posting code and then the assignment isnt as helpful
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

int main ()

{
//input variables
float NumberRight;
float TotalPoints;
float GradePercent;

ifstream inData;

// open file
inData.open ("Grade.in")

// read values
inData >> NumberRight >> TotalPoints;


//calculate values

GradePercent = NumberRight / TotalPoints

cout << "You got a "

if (GradePercent > 90)
{
cout "Excellent" endl;
}

if (GradePercent > 80)
{
cout "Well Done" endl;
}

if (GradePercent > 70)
{
cout "Good" endl;
}
else if (GradePercent >= 60)
{
cout "Need Improvement" endl;
}
else (GradePercent < 50)
{
cout "Fail" endl;
}

return 0;
}


Code tagged it for you. :-)
Last edited on
1) What is in the file?
2) Have you ever done switch / case statements
3) Need errors


closed account (Dy7SLyTq)
2) Have you ever done switch / case statements

switch can only take constants and sometimes function calls
Topic archived. No new replies allowed.