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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
Description
You will write a program that prompts the user for students.
Your program will then read in all the students and store them into a linked list.
The program will then print the names of the students.
Next, the program will prompt the user for a string.
The program will print the complete information for each student containing the string in the name.
An example run is depicted below:
Please enter the students. Enter the name, age, gpa, and semester of graduation (e.g. F13).
Enter an empty name to stop.
Jim John
19
3.04
F13
James Stevens
20
2.56
S13
Here are the students that you entered:
Jim John
James Stevens
Which student do you want? John
Name: Jim John, Age: 19, GPA: 3.04, Graduation Date: F13
Here are the students that you entered:
Jim John
James Stevens
Which student do you want? James
Name: James Stevens, Age: 20, GPA: 2.56, Graduation Date: S13
Here are the students that you entered:
Jim John
James Stevens
Which student do you want? J
Name: Jim John, Age: 19, GPA: 3.04, Graduation Date: F13
Name: James Stevens, Age: 20, GPA: 2.56, Graduation Date: S13
Here are the students that you entered:
Jim John
James Stevens
Which student do you want?
Goodbye!
Do the appropriate input validation for the age (between 1 and 120, inclusive), GPA (between 0 and 4 inclusive), and graduation date (a ’S’ or ’F’ followed by a number from 13 to 19). Allow the user to re-enter bad input until the user gets it right. Also, if the user enters a string not found in any name, print the error message “No students found”.
To determine if a string exists in another string, you can make use of the strstr() function. Remember to #include cstring. For information about the strstr() function, see
http://en.cppreference.com/w/cpp/string/byte/strstr or
http://www.cplusplus.com/reference/cstring/strstr/.
Note: You will get a poor assignment grade if you have a poor design. In other words, make good use of functions to modularize you assignment.
|