Hi, Im having trouble implementing a built in container in a class with a small program im making.
Im probably making a stupid mistake but cant figure it out. One of my tutors gave me a sample code to use, I studied it then threw it away as I was wanting to do it off my own back, stupid really.
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
|
#ifndef STUDENT_H
#define STUDENT_H
#include<iostream>
#include<vector>
#include<string>
struct Student_Details{
int student_number_;
std::string course_ID_;
std::string student_fname_;
std::string student_sname_;
int age_;
double grade_;
//constructor
Student_Details(int snumber = 0, std::string cid = "", std::string studentfname = "", std::string studentsname = "", int age = 0, double grade = 0)
:student_number_(snumber)
,course_ID_(cid)
,student_fname_(studentfname)
,student_sname_(studentsname)
,age_(age)
,grade_(grade)
{}
};
class StudentDB{
public:
int setstudent();
int displaystudent();
private:
typedef vector<Student_Details> StCon;
StCon Student_;
};
#endif
|
Here is the errors Im getting
>c:\users\michael\documents\visual studio 2010\projects\mystudent\mystudent.h(35): error C2143: syntax error : missing ';' before '<'
1>c:\users\michael\documents\visual studio 2010\projects\mystudent\mystudent.h(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\michael\documents\visual studio 2010\projects\mystudent\mystudent.h(35): error C2238: unexpected token(s) preceding ';'
1>c:\users\michael\documents\visual studio 2010\projects\mystudent\mystudent.h(36): error C2146: syntax error : missing ';' before identifier 'Student_'
1>c:\users\michael\documents\visual studio 2010\projects\mystudent\mystudent.h(36): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\michael\documents\visual studio 2010\projects\mystudent\mystudent.h(36): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>
regards