Advertisement
tonygms3

AutomatedPublishingSystem

Feb 28th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.67 KB | None | 0 0
  1. /* Automated Publication Management System*/
  2.  
  3.  
  4. #include<stdio.h>
  5. #include<string.h>
  6.  
  7. //using namespace std;
  8.  
  9. struct Author{ //creating a structure for writing.
  10.     //writing
  11.     char bookName[50];
  12.     char bookType[25];
  13.     int pages[100];
  14.     char bookGenre[20];
  15.     int price[100];
  16.     char countryOfPublication[30];
  17.  
  18.     //promoting
  19.     char bookTitle[50];
  20.     double discountedAmount[100];
  21.     int discountedPeriod[50];
  22.  
  23.  
  24.     };
  25.  
  26. void printInfo(struct Author writing)
  27.  {
  28.      printf("The Name of the book is %s\n",writing.bookName);//book name
  29.      printf("The Type of the book is  %s\n",writing.bookType);//book type
  30.      printf("The Genre of the book is %s\n",writing.bookGenre);//book genre
  31.      printf("The book is from %s\n",writing.countryOfPublication);
  32.      printf("The book has %d Pages\n",writing.pages);//page
  33.      printf("The price of the book is %d $\n",writing.price);
  34.  
  35.  }
  36. void printInfo(struct Author publish)
  37.  {
  38.      printf("The Title of the book is %s\n",publish.bookTitle);//book title
  39.      printf("The discounted amount is %.2lf\n",publish.discountedAmount);//book type
  40.      printf("The discount is valid for %d weeks\n",discount(writing.price););//book genre
  41. //     printf("The book is from %s\n",writing.countryOfPublication);
  42. //     printf("The book has %d Pages\n",writing.p[100]);//page
  43. //     printf("The price of the book is %.2lf $\n",writing.price[100]);
  44.  
  45.  }
  46. double discount(double price)//function for finding the discounted amount
  47. {
  48.     double amount;
  49.     if(price>=50)
  50.     {
  51.         amount=price*0.7;
  52.     }
  53.     else if(price>=150)
  54.  
  55.     {
  56.         amount=price*.5;
  57.     }
  58.     return amount;
  59. }
  60.  
  61. void scanInfo
  62. {
  63.  
  64.     struct Author writing;
  65.     struct Author publish;
  66.     //for writing
  67.     printf("Enter Name of the book\n");//book name
  68.     gets(writing.bookName);
  69.     printf("Enter the type of the book\n");//pdf or hardcopy
  70.     gets(writing.bookType);
  71.     printf("Enter the genre of the book\n");//genre of the book
  72.     gets(writing.bookGenre);
  73.     printf("Enter the country where the book is from\n");//country of publication
  74.     gets(writing.countryOfPublication);
  75.     printf("Enter number of pages\n");//page number
  76.     scanf("%d",&writing.p);
  77.     printf("Enter the price of the book\n");//price of the book
  78.     scanf("%d\n\n",&writing.price);
  79.     printInfo(struct Author writing);
  80.  
  81.     //for publishing
  82.     printf("Enter The title of the book %s",publish.bookTitle);
  83.     gets(publish.bookTitle);
  84.  
  85.  
  86.     //printInfo(struct Author publish);
  87.  
  88.  
  89. }
  90. int main()
  91. {
  92.     int i;
  93.     while(i)
  94.     {
  95.     if(i==0){
  96.         break;
  97.     }
  98.     else {
  99.      void scanInfo();
  100.     }
  101.     }
  102.  
  103.  
  104.  
  105.     return 0;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement