I am working on this project for a class. I have input the students last name, first name, student ID and three test scores. I have to make the first step a function that stores the data into an array. Inside this array it is also going to give the letter grade. it's supposed to look like the following except all lined up evenly:
Last Name First Name Id Test 1 Test 2 Test 3 Grade
Ant Adam 56789 65 72 68 D
Doe Jane 67890 54 64 52 F
Mix Tom 45678 98 83 74 B
Nerd Bobby 12345 95 96 99 A
Sunday Billy 34567 75 65 82 C
Thumb Tom 23456 87 93 77 B
The first problem I'm running up against is that my input code for the last name, first name etc is not stopping when I press the n key.
I think I need an if else statement that will stop if the user types 'N' but keep going if the user types 'Y' but since I only have 6 sets of data to put in the array. I'm fairly new to C++ and the two or three people I have spoken to in person about this project can't believe the project that I'm doing here for an entry level C++ class. I'm excited to learn though
Here is the code I have right now:
#include<iostream>
#include<string>
using namespace std;
int main()
{
int i = 0;
string studentInfo[7][7];
char inputDone = 'y';
for(i=0; inputDone = 'y'; i++)
{
cout << "Please Input student's first name : " << endl;
cin >> studentInfo[i][0];
cout << "Please Input student's last name : " << endl;
cin >> studentInfo[i][1];
cout << "Please Input student's ID Number : " << endl;
cin >> studentInfo[i][2];
cout << "Please Input student's Test 1 Grade : " << endl;
cin >> studentInfo[i][3];
cout << "Please Input student's Test 2 Grade : " << endl;
cin >> studentInfo[i][4];
cout << "Please Input student's Test 3 Grade : " << endl;
cin >> studentInfo[i][5];
cout << "Are there anymore student grades to enter? (y/n)" <<endl;
{
cin >> inputDone;
}
}