Advertisement
Mizuhara_Chizuru

Untitled

Jun 24th, 2021
237
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Code by Surya a.k.a Sunny*/
  2. /* by https://www.codechef.com/users/spsc */
  3. #include <bits/stdc++.h>
  4. #define lli long long
  5. #define pi 3.14159265358979323846
  6. #define MOD 1000000007
  7. #define foi(n)  for(lli i=0;i<n;i++)
  8. #define foj(n)  for(lli j=0;j<n;j++)
  9. #define test(T) lli T;cin>>T;while(T--)
  10. #define loop(i, a, b) for(int i = (a); i<= (b); i++)
  11. using namespace std;
  12. struct books
  13. {
  14.   char book_title[50];
  15.   int book_price,number_of_pages;
  16. }b1[10];
  17. int push(books &n)
  18. {
  19.   /*cin>>n.book_price);
  20.   cin>>n.book_title;
  21.   cin>>n.number_of_pages;*/
  22.   scanf("%s",&n.book_title);
  23.   scanf("%d",&n.book_price);
  24.   scanf("&d",&n.number_of_pages);
  25.   return 0;
  26. }
  27. int traverse(books &n)
  28. {
  29.   printf("Title of the book is = %s\n",n.book_title);
  30.   printf("Price of the book is = %d\n",n.book_price);
  31.   printf("Number of pages in the book are %d\n",n.number_of_pages);
  32.   printf("-------X------X---------X---------X-------X-------\n");
  33.   return 0;
  34. }
  35. int main()
  36. {
  37.   ios_base::sync_with_stdio(false);
  38.    cin.tie(NULL);
  39.    cout.tie(NULL);
  40.  
  41.    foi(2)
  42.    {
  43.      printf("Enter the detail of book with S.No. %d\n",i+1);
  44.      push(b1[i]);
  45.    }
  46.  
  47.    foi(2)
  48.    {
  49.      traverse(b1[i]);
  50.    }
  51.  
  52.  }
  53.  
Advertisement
RAW Paste Data Copied
Advertisement