Question about C++

Hi Everyone! I have a question about C++! I run the program, but it doesn't give the output!
Thank you so much in advance for all your help!

A teacher has five students who have taken four tests. The teacher uses the following
grading scale to assign a letter grade to a student, based on the average of his or her
four test scores.
90–100 A
80–89 B
70–79 C
60–69 D
0–59 F

Then it drops each student’s lowest score. Display the test score averages and letter grades.

#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
char printAverage(double num[], int number) {
char temp_grade;
for (int i = 0; i < number; i++) {
if (num[i] >= 90.0) {
temp_grade = 'A';
}
else if (num[i] >= 80.0) {
temp_grade = 'B';
}
else if (num[i] >= 70.0) {
temp_grade = 'C';
}
else if (num[i] >= 60.0) {
temp_grade = 'D';
}
else if (num[i] < 60.0) {
temp_grade = 'F';
}

}
return temp_grade;
}
int main() {
vector<string> name {"William", "Megan", "John", "Maria", Smith"};
int size_test = 4;
double score[5][size_test];

for(int i = 0; i < name.size(); i++) {
cout << "Student #" << i + 1 << ": " << name[i] << ":" << "\n";
for (int j = 0; j < size_test; j++) {
cout << "Enter the score for test " << j + 1 << ":";
cin >> score[i][j];
}
}

vector<double>lowest;

for (int i = 0; i < name.size(); i++) {
double temp_lowest = score[i][0];
for (int j = 0; j < size_test; j++) {
if (score[i][j] < temp_lowest) {
temp_lowest = score[i][j];
}
}
lowest.push_back(temp_lowest);
}

vector<double>total;
for (int i = 0; i < name.size(); i++) {
double temp_total = 0;
for (int j = 0; j < size_test; j++) {
temp_total += score[i][j];
}
total.push_back(temp_total);
}
double subtotal[5];
for (int i = 0; i < name.size(); i++) {
subtotal[i] = total[i] - lowest[i];
}
double average[5];
for (int i = 0; i = name.size(); i++) {
average[i] = static_cast<double>(subtotal[i] * 1.0) / (double)((size_test - 1) * 1.0);
}
vector<char>grade1;
for (int i = 0; i < name.size(); i++) {
char temp_grade = printAverage(average, name.size());
grade1.push_back(temp_grade);
}
cout << setprecision(2) << fixed << showpoint;
for (int i = 0; i < name.size(); i++) {
cout << name[i] << ": " << "Average score: " << average[i] << ", grade: " << grade1[i] << "\n";
}
return(0);
}
You need a quotation character in front of Smith.

1
2
vector<string> name {"William", "Megan", "John", "Maria", "Smith"};
                                                          ^
Topic archived. No new replies allowed.