I have finished writing a program where you can enter 20 students’ grades and calculate their averages as well as the total test average. However, although it does compile and run, I get the following warnings:
In constructor 'student::student()':
warning: 'student::name' should be initialized in the member initialization list
note: synthesized method 'student::student()' first required here
What causes this? I’m assuming it’s worth noting and fixing, so how would I fix it? I have included what I believe to be the relevant parts of the code for review:
#include <iostream>
#include <string>
using namespace std;
struct student
{ // The first warning is for this line
string name;
double testGrade[5];
};
student theStudent[20]; // The second warning is for this line
I appreciate any help you can offer to me.
You can disregard that warning as nonsense. What compiler/version/flags are you using?