Write a small (mathrm{C}++) program to prompt a user to enter information regarding a student, and print

Question:

Write a small \(\mathrm{C}++\) program to prompt a user to enter information regarding a student, and print out the data. Use the following steps to write your code:

1.) Create a data type for student using a class or struct. Student information should minimally include firstName, lastName, gpa, and the currentCourse in which the student is registered. This information may be stored in a simple class. You may utilize either char arrays to represent the string fields since we have not yet covered pointers, or you may (preferably) utilize the string type. Also, you may read in this information in the main() function rather than creating a separate function to read in the data (since the latter will require knowledge of pointers or references). Please do not use global (that is, external variables).

2.) Create a function to print out all the data for the student. Remember to prototype this function. Use a default value of 4.0 for gpa in the prototype of this function. Call this function two ways: once passing in each argument explicitly, and once using the default gpa.

3.) Now, overload the print function with one that either prints out selected data (for example, lastName and gpa) or with a version of this function that takes a student as an argument (but not a pointer or reference to a student - we'll do that later). Remember to prototype this function.

4.) Use iostreams for I/O.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer: