error in the main

#pragma once
#include<string>
#include<iostream>
using namespace std;

class Student
{
int id;
string firstName;
string lastName;
string coursName;
double firstExamGrade;
double secondExamGrade;
double finalExamGrade;
double fiveAssGrade;
public:
void setId(int);
int getId();
void setLastName(string);
string getLastName();
void setFirstName(string);
string getFirstName();
void setCoursName(string);
string getCoursName();
void setFirstExamGrade(double);
double getFirstExamGrade();
void setSecondExamGrade(double);
double getSecondExamGrade();
void setFinalExamGrade(double);
double getFinalExamGrade();
void setFiveAssGrade(double);
double getFiveAssGrade();
};
/////////
#include "Student.h"

void Student::setId(int a)
{
id =a;
}
int Student::getId()
{
return id;
}
void Student ::setCoursName(string a)
{
coursName=a;
}
string Student ::getCoursName()
{
return coursName;
}
void Student ::setFirstName(string a)
{
firstName=a;
}
string Student ::getFirstName()
{
return firstName;
}
void Student::setLastName(string a)
{
lastName=a;
}
string Student ::getLastName()
{
return lastName;
}
void Student ::setFirstExamGrade(double a)
{
firstExamGrade =a;
}
double Student::getFirstExamGrade()
{
return firstExamGrade;

}
void Student ::setSecondExamGrade(double a)
{
secondExamGrade=a;
}
double Student ::getSecondExamGrade()
{
return secondExamGrade;
}
void Student::setFinalExamGrade(double a)
{
finalExamGrade=a;
}
double Student::getFinalExamGrade()
{
return finalExamGrade;
}
void Student ::setFiveAssGrade(double a)
{
fiveAssGrade=a;
}
double Student ::getFiveAssGrade()
{
return fiveAssGrade;
}
///////
#include<iostream>
#include<string>
#include"Student.h"
using namespace std;
void main()
{
int num;
cout<<"plese insert number of student "<<endl;
cin>>num;
/*Student x[num];// error
for(int i=1;i<=num;i++)
{ int I;
string F ,L,C;
double RE,SE,FE,A;
cin>>x[i].setId(I);
cin>>x[i].setFirstName(F);
cin>>x[i].setLastName(L);
cin>>x[i].setCoursName(C);
cin>>x[i].firstExamGrade(RE);
cin>>x[i].secondExamGrade(SE);
cin>>x[i].finalExamGrade(FE);
cin>>x[i].fiveAssGrade(A)
}
*/

/*int x[num];
for(int i=1;i<=num;i++)
{





}
*/

}
Please don't make us guess. If there is an error message, tell us what the error message is.

/*Student x[num];// error */
If you mean this, then it's incorrect C++ because you can't have variable sied arrays on the stack, but if your compiler accepts void main() then you don't have a C++ compiler and frankly it could accept any nonsense.
Last edited on
Topic archived. No new replies allowed.