Advertisement
Guest User

Untitled

a guest
May 20th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <iomanip>
  6. using namespace std;
  7. struct firm
  8. {
  9. char surname[20];
  10. char position[25];
  11. int year_of_birth;
  12. int experience;
  13. int salary;
  14. };
  15. int main()
  16. {
  17. setlocale(LC_ALL, "Russian");
  18. int a;
  19. firm *str;
  20. do
  21. {
  22. cout << "Кол.во сотрудников фирмы ";
  23. cin >> a;
  24. } while (a <= 0);
  25. str = new firm[a];
  26. cout << "Сотрудники фирмы " << endl;
  27. cout << endl;
  28.  
  29. for (int i = 0; i < a; i++)
  30. {
  31. cout << "Фамилия ";
  32. cin >> str[i].surname;
  33. cout << "Должность ";
  34. cin >> str[i].position;
  35. cout << "Год рождения ";
  36. cin >> str[i].year_of_birth;
  37. cout << "Стаж ";
  38. cin >> str[i].experience;
  39. cout << "Оклад ";
  40. cin >> str[i].salary;
  41. }
  42. cout << "+---------+-----------+--------------+------+-------+" << endl;
  43. cout << "|Фамилия |Должность |Год рождения |Стаж |Оклад |" << endl;
  44. cout << "+---------+-----------+--------------+------+-------+" << endl;
  45. for (int i = 0; i < a; i++)
  46. {
  47. cout << "|" << setw(9) << str[i].surname << "|" << setw(11) << str[i].position << "|" << setw(14) << str[i].year_of_birth << "|" << setw(6) << str[i].experience << "|" << setw(7) << str[i].salary << "|" << endl;
  48. cout << "+---------+-----------+--------------+------+-------+" << endl;
  49. }
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement