I have a program that takes two separate arrays one of all the peoples names and the other of their test scores. I am not sure how to display the scores in a table view. here is my code so far
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
void DisplayArrays(string a, int b)
{
cout << "Name " << "Score" << endl;
cout << "===================" << "=====" << endl;
cout << a << b;
}
int main()
{
const int ATIME = 20;
string studentNames[ATIME];
int scores[ATIME];
cout << "When you have entered all students names and scores" << endl;
cout << "type 'stop' to display the names and scores in a list view" << endl;
for (int i = 0; i < ATIME ; i++)
{
cout << "Enter student name: "<< endl;
cin >> studentNames[i];
cout << endl;
if (studentNames[i] == "stop")
{
break;
}
cout << "Enter score: " << endl;
cin >> scores[i];
cout << endl;
}
cout << endl;
DisplayArrays(studentNames[ATIME], scores[ATIME]);
return 0;
}
my problem is that i get an unexpected error in the DisplayArrays function. Can anyone tell my why i get his error and how to get rid of the error
thanks alot