Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Automated Publication Management System*/
- #include<stdio.h>
- #include<string.h>
- //using namespace std;
- struct Author{ //creating a structure for writing.
- //writing
- char bookName[50];
- char bookType[25];
- int pages[100];
- char bookGenre[20];
- int price[100];
- char countryOfPublication[30];
- //promoting
- char bookTitle[50];
- double discountedAmount[100];
- int discountedPeriod[50];
- };
- void printInfo(struct Author writing)
- {
- printf("The Name of the book is %s\n",writing.bookName);//book name
- printf("The Type of the book is %s\n",writing.bookType);//book type
- printf("The Genre of the book is %s\n",writing.bookGenre);//book genre
- printf("The book is from %s\n",writing.countryOfPublication);
- printf("The book has %d Pages\n",writing.pages);//page
- printf("The price of the book is %d $\n",writing.price);
- }
- void printInfo(struct Author publish)
- {
- printf("The Title of the book is %s\n",publish.bookTitle);//book title
- printf("The discounted amount is %.2lf\n",publish.discountedAmount);//book type
- printf("The discount is valid for %d weeks\n",discount(writing.price););//book genre
- // printf("The book is from %s\n",writing.countryOfPublication);
- // printf("The book has %d Pages\n",writing.p[100]);//page
- // printf("The price of the book is %.2lf $\n",writing.price[100]);
- }
- double discount(double price)//function for finding the discounted amount
- {
- double amount;
- if(price>=50)
- {
- amount=price*0.7;
- }
- else if(price>=150)
- {
- amount=price*.5;
- }
- return amount;
- }
- void scanInfo
- {
- struct Author writing;
- struct Author publish;
- //for writing
- printf("Enter Name of the book\n");//book name
- gets(writing.bookName);
- printf("Enter the type of the book\n");//pdf or hardcopy
- gets(writing.bookType);
- printf("Enter the genre of the book\n");//genre of the book
- gets(writing.bookGenre);
- printf("Enter the country where the book is from\n");//country of publication
- gets(writing.countryOfPublication);
- printf("Enter number of pages\n");//page number
- scanf("%d",&writing.p);
- printf("Enter the price of the book\n");//price of the book
- scanf("%d\n\n",&writing.price);
- printInfo(struct Author writing);
- //for publishing
- printf("Enter The title of the book %s",publish.bookTitle);
- gets(publish.bookTitle);
- //printInfo(struct Author publish);
- }
- int main()
- {
- int i;
- while(i)
- {
- if(i==0){
- break;
- }
- else {
- void scanInfo();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement