Advertisement
akosiraff

Student CPP

Nov 5th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/student-cpp/
  3. Create a class named Student that has three member variables:
  4. • name – A string for the name of the student.
  5. • numClasses – An integer for how many courses the student is currently enrolled in.
  6. • classList – An array of strings for the names of the classes the student is enrolled in.
  7. Write appropriate constructor(s), mutator (set), and accessor (get) methods for the class
  8. along with the following:
  9. • A function that inputs all values from the user, including the list of class names.
  10. • A function that outputs the name and list of all courses.
  11. • A function that resets the number of classes to 0 and the classList to an empty array
  12. (with null strings).
  13. The main() should test all of these functions. It should perform the following steps in a loop:
  14. • It should ask the user to input a students data.
  15. • Display the entered data back (in a well-formatted way).
  16. • Ask the user if they want to enter the data again (y/n).
  17. 1• If ’n’, then the program ends, otherwise it should clear the student class object and
  18. repeat the loop (ask the user to enter new data…).
  19. Note: The statement ‘cin >> variable;’ leaves a newline character in the buffer. This can be
  20. a problem if you are mixing ‘cin >> variable;’ and the ‘getline’ function (that reads a line
  21. of input). Use ‘cin.ignore’ function to discard the newline character after using ‘cin’.
  22. Filename: student.cpp
  23. Download: http://solutionzip.com/downloads/student-cpp/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement