Hi, i have my program to load info about students from .txt file
1 2 3 4 5
Mrkvicka Jozef 2 1.75 2.1 0.4 1 0.49 1.27
Hrasko Jan 0.1 0.38 1 1.2
Mladek Peter 1.6 0.4 2 1.3 1.8
Petrzlen Robert 0.6 0 1.1 1.1 0.6 0.59
Horvath Ivan 1.6 0.8 0.7 1.3 1
My program is ruuning perfectly only problem is that i must transform it to program uses class, class student . Am very beginer in using classes, so far i do very easy programs using classes.
i try to make it but its too difficult for me. in that student.h and student .cpp is 50 errors..:(
50 errors might look overwhelming but note that one error often causes a bunch of extra errors in the code that follows so it's usually not as bad as it looks. Start at the top and fix the first error in the list, and then see what errors you have left.
and if i just try to start program with student.h and .cpp , w/o any code in main there is 20 errors. just try to strat it like me only with student.h and .cpp and uwill see
In student.h I get a lot of errors because you have forgot to specify that you mean string and vector in the std namespace. Adding std:: in front of all occurrences of string and vector in that file fixes the problem.
In student.cpp you have again forgot to put std:: in front of vector on line 4. You have also specified that getStudent() should return a STUDENT object but you are trying to return the whole vStudent vector so that generates another error.
student.cpp Line 1, 11. Get rid of stdafx.h, _tmain and TCHAR. These are Microsoft specific. Make this a simple and portable console project. _tmain and TCHAR make your program non-portable.
student.h line 19. Since this is a collection of students, I would make the name of the class plural (students) to indicate that it contains multiple students.
student.h line 24: I would return vector<STUDENT> by reference. Returning by value causes the entire vector to be copied.
main.cpp line 65: I would make the loop variable unsignedint. int causes a compiler warning due to a type mismatch with the return type of body.size().
main.cpp line 15: I'm unclear what this vector is used for. I see you iterate through it at line 65, but I don't see you ever put anything in the vector.