Apr 11, 2019 at 6:44pm Apr 11, 2019 at 6:44pm UTC
error in line 18,21. can someone help me with this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
using namespace std;
#include <iostream>
struct Student
{
char FirstName[30];
char LastName[30];
double GPA;
double ACT;
double SAT;
};
void Scount(Student[], int );
int main()
{
int numStudents;
cout << "how many student do you have?" ;
cin >> numStudents;
Student students[numStudents];
for (int i = 0; i < numStudents; i++)
{
cout << "Please enter first name" ;
cin >> students[i].FirstName;
cout << "Please enter Last name" ;
cin >> students[i].LastName;
cout << "Please enter GPA grade" ;
cin >> students[i].GPA;
cout << "Please enter ACT grade" ;
cin >> students[i].ACT;
cout << "Please enter SAT grade" ;
cin >> students[i].SAT;
}
Scount(students, numStudents);
}
Last edited on Apr 11, 2019 at 7:00pm Apr 11, 2019 at 7:00pm UTC
Apr 11, 2019 at 6:56pm Apr 11, 2019 at 6:56pm UTC
C++ is case-sensitive. Firstname != FirstName. Lastname != LastName.
PS: Your program might compile, but it's technically not standard C++, because C++ doesn't allow for variable length arrays (VLAs), like you have on line 21.
You could change it to an std::vector or change the array to have a static max size.
Last edited on Apr 11, 2019 at 6:58pm Apr 11, 2019 at 6:58pm UTC