Advertisement
evgenko

Sasha_lab_10

Dec 10th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. struct Date{
  4.     int month;
  5.     int day;
  6.     int year;
  7. };
  8. struct Note{
  9.     int number_of_shop;
  10.     struct Date date;
  11.     float money;
  12.     char surname[30];
  13. };
  14.  
  15. int main(){
  16.     int n;
  17.     printf("Enter the count of notes: ");
  18.     scanf("%d",&n);
  19.     struct Note notes[n];
  20.     for (int i=0;i<n;i++){
  21.         printf("Enter the number of shop: ");
  22.         scanf("%d",&notes[i].number_of_shop);
  23.         printf("Enter the date\n");
  24.         printf("Enter the month: ");
  25.         scanf("%d", &notes[i].date.month);
  26.         printf("Enter the day: ");
  27.         scanf("%d", &notes[i].date.day);
  28.         printf("Enter the year: ");
  29.         scanf("%d", &notes[i].date.year);
  30.         printf("Enter the money: ");
  31.         scanf("%f", &notes[i].money);
  32.         printf("Enter the surname: ");
  33.         scanf("%s", notes[i].surname);
  34.         printf("---------------------\n");
  35.     }
  36.  
  37.     printf("Enter the day: ");
  38.     int d;
  39.     scanf("%d", &d);
  40.     printf("Enter the money: ");
  41.     float a;
  42.     scanf("%f", &a);
  43.     printf("----------------------\n");
  44.  
  45.     for (int i=0;i<n;i++){
  46.         if ((notes[i].date.day==d)&&(notes[i].money<a)){
  47.             printf("Number of shop: %d\n",notes[i].number_of_shop);
  48.         }
  49.     }
  50.     printf("---------------------\n");
  51.  
  52.     printf("Enter the number of shop: ");
  53.     int number;
  54.     scanf("%d",&number);
  55.  
  56.     for (int i=0;i<n;i++){
  57.         if (notes[i].number_of_shop == number){
  58.             printf("Surname: %s",notes[i].surname);
  59.         }
  60.     }
  61.  
  62.     return 0;
  63. }
  64.  
  65.  
  66. /*
  67.  
  68.  
  69. lol kek cheburek
  70. cheburek kek lol
  71.  
  72.  
  73.  
  74.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement