Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. using namespace std;
  5.  
  6. struct Student
  7. {
  8.     int age;
  9.     string name;
  10.     bool gender;
  11. };
  12. int main()
  13. {
  14.     cout << "Number of students:";
  15.     int count;
  16.     cin >> count;
  17.     Student *stdnt = new Student[count];
  18.     for (int i = 0; i < count; ++i)
  19.     {
  20.         cout << "Vvodite:" << "\nName:";
  21.         cin >> stdnt[i].name;
  22.         cout << "Age:";
  23.         cin >> stdnt[i].age;
  24.         string temp;
  25.         cout << "Gender:";
  26.         cin >> temp;
  27.         if (temp == "man")
  28.         {
  29.             stdnt[i].gender = true;
  30.         }
  31.         if (temp == "woman")
  32.         {
  33.             stdnt[i].gender = false;
  34.         }
  35.     }
  36.     cout << "OUTPUT..." << endl;
  37.     cout << "№\tname\tsex\tage" << endl;
  38.  
  39.     for (int i = 0; i < count; ++i)
  40.     {
  41.         if (stdnt[i].gender)
  42.         {
  43.             cout << i+1 << "\t" << stdnt[i].name << "\tMale" << "\t" << stdnt[i].age << endl;
  44.         }
  45.         else
  46.         {
  47.             cout << i+1 << "\t" << stdnt[i].name << "\tFemale" << "\t" << stdnt[i].age << endl;
  48.         }
  49.     }
  50.     cout << "End" << endl;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement