C++ Create parallel arrays?

This is my homework does not work with me!! the question is 1-A teacher has 6 students who each receive a grade of either P for pass or F for fail in the class. 2-Create parallel arrays. One will be an array of string objects. The other will be an array of character objects. 3-You will have the user enter the... show more This is my homework does not work with me!!
the question is
1-A teacher has 6 students who each receive a grade of either P for pass or F for fail in the class.
2-Create parallel arrays. One will be an array of string objects. The other will be an array of character objects.
3-You will have the user enter the names and the grade in a for loop. No spelling errors!!
4-You will also count the number of Ps and the number of Fs in a separate for loop. Display each student s name and grade.
5-Display the grade counts at the end.

here is what I did

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
const int NUM_STUDENTS = 6; // Number of STUDENTS
int names[NUM_STUDENTS] ;
double grade[NUM_STUDENTS];

// Input the names of students.
cout << "Enter " << NUM_STUDENTS
<< " names of students who each receive a grade of\n"
<< "either P for pass or F for fail in the class.\n";
for (int val = 0; val < NUM_STUDENTS; val++)
{
cout << "student's name #" << (val + 1) << ": ";
cin >> names[val];
cout << "The degree of student obtained in the class #" << (val + 1) << ": ";
cin >> grade[val];
}

// Display each the grade for each students.
cout << "Here is the grade for each students:\n";
cout << fixed << showpoint << setprecision(2);
for (int val = 0; val < NUM_STUDENTS; val++)
{
double Totalgrade = names[val] * grade[val];
cout << "Students #" << (val + 1);
cout << ": $" << Totalgrade << endl;
}

system("pause");
return 0;
}
2 answers 2