Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- struct Student
- {
- int age;
- string name;
- bool gender;
- };
- int main()
- {
- cout << "Number of students:";
- int count;
- cin >> count;
- Student *stdnt = new Student[count];
- for (int i = 0; i < count; ++i)
- {
- cout << "Vvodite:" << "\nName:";
- cin >> stdnt[i].name;
- cout << "Age:";
- cin >> stdnt[i].age;
- string temp;
- cout << "Gender:";
- cin >> temp;
- if (temp == "man")
- {
- stdnt[i].gender = true;
- }
- if (temp == "woman")
- {
- stdnt[i].gender = false;
- }
- }
- cout << "OUTPUT..." << endl;
- cout << "№\tname\tsex\tage" << endl;
- for (int i = 0; i < count; ++i)
- {
- if (stdnt[i].gender)
- {
- cout << i+1 << "\t" << stdnt[i].name << "\tMale" << "\t" << stdnt[i].age << endl;
- }
- else
- {
- cout << i+1 << "\t" << stdnt[i].name << "\tFemale" << "\t" << stdnt[i].age << endl;
- }
- }
- cout << "End" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement