Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <fstream>
  7. #include <locale>
  8. #define N 30 //max broj ychastnichi
  9. using namespace std;
  10.  
  11. void disp(int i);
  12. void input();
  13. void list();
  14. void teen();
  15. void load();
  16. int menu();
  17.  
  18. typedef struct
  19. {
  20. char nomer[10];
  21. char ime[10];
  22. char family[10];
  23. int age;
  24. float visochina;
  25. float teglo;
  26. char country[3];
  27. }girl;
  28.  
  29. int main(){
  30. int i;
  31. cout << "\n Зареждане от файл\n";
  32. load();
  33. do
  34. {
  35. i = menu();
  36. switch (i)
  37. {
  38. case 1: input(); break;
  39. case 2: list(); break;
  40. case 3: teen(); break;
  41.  
  42. }
  43.  
  44. } while (i != 4);
  45. return 0;
  46. }
  47.  
  48.  
  49. girl d[N];
  50. int top = 0;
  51. float height;
  52. float weight;
  53.  
  54. void input(){
  55. int i, n;
  56. do
  57. {
  58. cout << "\n Какъв е броят на участничките: ";
  59. cin >> n;
  60. } while (n<1 || n>N);
  61. fflush(stdin);
  62. for (i = top; i < n; i++)
  63. {
  64. cout << "\n Номер: ";
  65. cin >> d[N].nomer;
  66. cout << "\n Име: ";
  67. cin >> d[N].ime;
  68. cout << "\n Фамилия: ";
  69. cin >> d[N].family;
  70. cout << "\n Години: ";
  71. cin >> d[N].age;
  72. cout << "\n Височина(В см): ";
  73. cin >> d[N].visochina;
  74. cout << "\n Тегло(В кг): ";
  75. cin >> d[N].teglo;
  76. cout << "\n Държава: ";
  77. cin >> d[N].country;
  78. }
  79. top += n;
  80. }
  81.  
  82.  
  83. void disp(int i){
  84. cout << "\n " << d[N].nomer << "\t" << d[N].ime << "\t" << d[N].family << "\t" << d[N].age << "\t" << d[N].visochina << "\t"
  85. << d[N].teglo << "\t" << d[N].country << endl;
  86. }
  87.  
  88. void list(){ //Списък на участничките
  89.  
  90. int i;
  91. cout << "\n Списък на участничките\n";
  92. for (i = 0; i<top; i++)
  93. disp(i);
  94. }
  95.  
  96. void teen(){
  97. int i;
  98.  
  99. cout << "\n Списък на участничките до 20 години\n";
  100. for (i = 0; i < top; i++)
  101. {
  102. d[N].age *= 1;
  103. if (d[N].age<20)
  104. disp(i);
  105. }
  106. }
  107.  
  108.  
  109. void load(){
  110. FILE *fp;
  111. }
  112.  
  113. int menu(){
  114. int ch;
  115. cout << "\n_______________МИС СВЯТ_____________________";
  116. cout << "\n 1. Въведи броя на участничките";
  117. cout << "\n 2. Изведи списък на всички участнички";
  118. cout << "\n 3. Изведи списък на всички участнички до 20 години";
  119. cout << "\n 4. Изход";
  120.  
  121. do
  122. {
  123. cout << "\n Избор: ";
  124. cin >> ch;
  125. } while (ch<1 || ch>4);
  126. return(ch);
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement