Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- #include "list"
- #include "string"
- using namespace std;
- class University {
- public:
- string university;
- string rektor;
- private:
- int numberOfEmployees;
- int numberOfFaculties;
- int numberOfDirections;
- int numberOfStudents;
- int numberOfProfessors;
- public:
- void set() {
- cout << "\nUniversity's name: "; getline(cin, university);
- cout << "Rektor's fullname: "; getline(cin, rektor);
- cout << "Number Of Employees: "; cin >> numberOfEmployees;
- cout << "Number Of Faculties: "; cin >> numberOfFaculties;
- cout << "Number Of Directions: "; cin >> numberOfDirections;
- cout << "Number Of Students: "; cin >> numberOfStudents;
- cout << "Number Of Professors: "; cin >> numberOfProfessors;
- }
- void Print() {
- cout << "\nUniversity's name: " << university;
- cout << "\nRektor's fullname: " << rektor;
- cout << "\nNumber Of Employees: " << numberOfEmployees;
- cout << "\nNumber Of Faculties: " << numberOfFaculties;
- cout << "\nNumber Of Directions: " << numberOfDirections;
- cout << "\nNumber Of Students: " << numberOfStudents;
- cout << "\nNumber Of Professors: " << numberOfProfessors;
- }
- };
- void FindAndPrint(University* univer) {
- string keyword; int counter = 0;
- cout << "\nEnter keyword for searching: "; getline(cin, keyword);
- for (int i = 0; i < 4; i++) {
- if (strstr(univer[i].university.c_str(), keyword.c_str()) || strstr(univer[i].rektor.c_str(), keyword.c_str())) {
- univer[i].Print(); counter++;
- }
- }
- if (counter == 0) cout << "There is no similarities!";
- }
- int main() {
- University univer[4];
- cout << "Entering Universities: ";
- for (int i = 0; i < 4; i++) {
- univer[i].set();
- }
- FindAndPrint(univer);
- return 0;
- }
Add Comment
Please, Sign In to add comment