#include <iostream>
#include <string>
#include <list>
Go to the source code of this file.
◆ main()
Definition at line 13 of file cp9.1list.cpp.
13 {
14 string input;
15 list<student> record;
16 while (true) {
17 cin >> input;
19 if (input == "Add") {
21 record.push_back(temp);
22 cout << "Added Successfully" << endl;
23 }
24 else if (input == "Search") {
25 list<student>::iterator itr;
26 bool found = false;
28 for (itr = record.begin(); itr != record.end(); itr++) {
29 if (itr->name == temp.
name && itr->major == temp.
major) {
30 cout << "Student number:" << itr->number << endl;
31 found = true;
32 break;
33 }
34 }
35 if (!found) {
36 cout << "No Record found" << endl;
37 }
38 }
39 else if (input == "Quit") {
40 cout << "Bye" << endl;
41 break;
42 }
43 }
44}
References student::major, student::name, and student::number.