Advertisement
Asmund_11

Untitled

Oct 10th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int n;
  4. typedef struct {
  5.     int k; char arr[100];
  6. } type;
  7. type list[35];
  8. void Input(type list[]);
  9. void Output(type list[]);
  10.  
  11. int main()
  12. {
  13.     system("chcp 1251");
  14.     printf("Скільки записів буде введено?\t");
  15.     scanf_s("%d", &n);
  16.     Input(list);
  17.     Output(list);
  18.     return 0;
  19. }
  20.  
  21. void Input(type list[])
  22. {
  23.     for (int i = 0; i < n; i++) {
  24.         printf("\nКлюч: ");
  25.         scanf_s("%d", &list[i].k);
  26.         printf("\nПовідомлення: ");
  27.         gets(list[i].arr);
  28.         printf("\n");
  29.     }
  30. }
  31.  
  32. void Output(type list[])
  33. {
  34.     for (int i = 0; i < n; i++) {
  35.         printf("\n%d", list[i].k);
  36.         puts(list[i].arr);
  37.         printf("\n");
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement