Hey guys, I need to write a class named student that gets the
1. student name
2. integer id number
3. classes registered- using array of strings
I'm supposed to use constructors for this class, and write get and set functions, and also in main, create two instances of students. My current code only gets the student name and id number, not the classes registered. It is also just one instance of a student.
Any help is greatly appreciated.
The commented code will get you entire line.
For example if user enters "geo phy chem" on command line then x will contain all three words/strings. What you need is array of "char *" (or std::string if you are allowed to do that)
for crashing, try changing line 75 to char x[size]={0};
You need to add an array of strings as a private member field. Give the array a maximum capacity (lets says 1000) and start with a size of 0.
I would have an addClass() function that adds a class to the end of the array (while also incrementing size accordingly), and a printClass() function which prints the entire array.
Hey guys, actually I was supposed to just code in the values for the courses registered. There was no need to prompt the user. How would I do this then?