Original Post
I'm brand new to programming and am taking a C++ class but am having some trouble with an assignment. I figured gamedevs were a good source of information and hopefully you guys can help. Anyways, the problem is i need to create a program that allows you to enter a number and it will print out a grade coresponding to that point using one dimensional parallel arrays. I have no idea where i went wrong but it doesn't work and i don't have the ability for it to print out the grade based on a maximum and minimum amount of points. The arrays need to be setup as follows: Min points max points grade 0 299 F 300 349 D 350 399 C 400 449 B 450 500 A Here is the code for what i have comeup with so far: #include #include #include using std::cout; using std::cin; using std::endl; using std::string; int main() { //declare variables and arrays int minPoints[5] = {0, 300, 350, 400, 450}; string grade[5] = {"F", "D", "C", "B", "A"}; string searchByPoints = " "; //get the points the student earned cout << "Enter the number of points (X to exit): "; getline(cin, searchByPoints); while (searchByPoints != "X") { //locate position of grade in array int y = 0; //keeps track of array subscripts while (y < 5 && grade[y] != searchByPoints) y = y + 1; //end while //if grade found display it, otherwise display error message if (y < 5) cout << "The grade is: " << grade[y] << endl; else cout << "Points not possible." << endl; //end if //get the points the student earned cout << "Enter the number of points (X to exit): "; getline(cin, searchByPoints); } //end while return 0; } //end of main function Any help would be greatly appreciated, thanks. :D