Ok I'm really stuck, I'm really struggling to understand this C++ stuff, and I'm doing stuff that's VERY basic. What I need help with is creating a parallel array that allows the user to input a number and then depending on that number I want the array to give me specific data. for example....
initialize the array with 5 students names, Bob, Mary, Mike, Joe, Susan. In the second array, initialize the array with these test scores averages, 95, 80, 90, 65, 92. When running the program, the user will prompted to enter a number between 1 and 5. If the number entered is 1, the program should print "Student 1 is Bob, who has a test score average of 95".
make sense? Can someone help me get started? even if you can give me something that works with completely different data, just as long as I can get the jist of it.
Fill it with the appropriate information you need then prompt the user for a number:
1 2 3
std::cin >> number;
std::cout << "Student 1 is " << Students[number - 1] << "who has a test score average of " << Average[number - 1] << std::endl;
// You access number - 1 of the array because if you enter 1, you are trying to access the first member which is in fact 0
You also might want to add some checking to make sure the number they enter is between 1 - 5.