Having issues with this Program why wont it run?

Having issues with this Program why wont it run? it wont recognize inLab or inMx
plz help



#include <string>
#include <iostream>

using std::cout;
using std::endl; // Get # of Students
using std::cin; // Asle system for arrays (allocate memory) 3 arrays Lab, MX, FX - int* lab = new int[numStudents];x3
using std::string; // Get Scores
// Calculate Grades
// Output Report
// Return Memory



inline int round (float num) { return num + 0.5f; }
int main()
{

// Constants+ 0.5f; }
// Assessment percent of final grade
const float kLabPercent = .70f,
kMXPercent = .15f,
kFXPercent = .15f;
const string kSpacer(" "),
kWelcomeMessage ("\nClassPass - student grade calculator"),
kCountPrompt ("\nPlease enter number of students:"),
kLabPrompt (" Lab score (0-100): "),
kMXPrompt (" MX grade (0-100): "),
kFXPrompt (" FX grade (0-100): "),
kApprovePrompt ("A)ccept, R)e-enter or eX)it:"),
kErrorPrompt ("I don't understand that key."),
kStudent ("Student "),
kStudentGradeReport ("Grade Report -------------"),
kRepStudent ("Student:"),
kRepPoints ("Points:"),
kRepRounded ("Rounded:"),
kRepGrade ("Grade: "),
kGoodbyeMessage ("\nClassPass - is complete");


int numStudents;
cout << kWelcomeMessage ;
cout << kCountPrompt ;
int * lab = new int [numStudents];
int * MX = new int [numStudents];
int * FX = new int [numStudents];

int studentNdx = 0;
do {
int inLab, inMx, inFx;
cout << kLabPrompt ; cin >> inLab;
cout << kMXPrompt ; cin >> inMx;
cout << kFXPrompt ; cin >> inFx;

char key;
key = toupper(key);
if(key == 'X'){
cout << kGoodbyeMessage;
delete [] FX;
delete [] MX;
delete [] lab;
return EXIT_SUCCESS;
}
else (key == 'R') {
cout << kLabPrompt ; cin >> inLab;
cout << kMXPrompt ; cin >> inMx;
cout << kFXPrompt ; cin >> inFx;
}
else if (key =! 'R', 'X'){
cout << kErrorPrompt;
cout << kApprovePrompt;
}

}while (studentNdx < numStudents);


float repPoints;
repPoints = (inLab * kLabPercent) + (inMx * kMXPercent) + (inFx * kFXPercent);


int repRounded = round (repPoints);
string letterGrade ;

if (repRounded >= 97){
letterGrade == "A+";
}else if (repRounded >= 93){
letterGrade == "A";
}else if (repRounded >= 90){
letterGrade == "A-";
}else if (repRounded >= 87){
letterGrade == "B+";
}else if (repRounded >= 84){
letterGrade == "B";
}else if (repRounded >= 80){
letterGrade == "B-";
}else if (repRounded >= 77){
letterGrade == "C+";
}else if (repRounded >= 74){
letterGrade == "C";
}else if (repRounded >= 70){
letterGrade == "C-";
}else if (repRounded >= 67){
letterGrade == "D+";
}else if (repRounded >= 64){
letterGrade == "D";
}else if (repRounded >= 60){
letterGrade == "D-";
}else if (repRounded >= 59){
letterGrade == "F";
}





delete [] lab;
delete [] MX;
delete [] FX;

return EXIT_SUCCESS;
}
Last edited on
Please use code tags and indent your code.
Line 14: Your float calculation is going to get truncated to an int. This is probably okay, but you should get rid of the warning.

Line 64: Missing if keyword

Line 68: Improper use of comma operator. You can't have an implied left side operand.

Line 75: inLab, inMx, inFx were declared at line 49 within the scope of the do/while. They went out of scope at line 72 and are no longer defined at line 75.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Last edited on
Topic archived. No new replies allowed.