can you please help in this c programming?
i am suppose to print the books using string, but wud have to use array, i tried it but its not working, and also for each of the books , an address shud be printed, i tried that using a pointer but is only printing one general address, wud writing the books as string be a form of structure?. here is ma source code
Code:
#include <stdio.h>
#include <conio.h>
int discount (int x);
int tax (int y);
main ()
{
int code[10];
int i,after_discount;
float after_tax;
int total;
int cost=500;
float date;
printf("Enter the date the books were purchased mm.yyyy\t");
scanf("%f",&date);
for (i=0;i<10;i++){
printf ("Enter the book code:\t ");
scanf ("%d", &code[i]);
}
total = 500.00 * 10;
after_discount = total - discount (cost);
after_tax = after_discount + tax (total);
clrscr();
printf ("**************************Triple S&T Bookstore****************************\n");
printf( "%10s%45s\n", "***BOOKS***", "***CODES***" );
printf ("A Painted House\t %35d\n", code [0]);
printf ("The Firm\t %35d\n", code [1]);
printf ("The Testament\t %35d\n", code [2]);
printf ("Pelican Brief\t %35d\n", code [3]);
printf ("Runaway Jury\t %35d\n", code [4]);
printf ("Rain Maker\t %35d\n", code [5]);
printf ("Street Lawyer\t %35d\n", code [6]);
printf ("A Time to Kill\t %35d\n", code [7]);
printf ("The Confession\t %35d\n", code [8]);
printf ("Bleachers\t %35d\n", code [9]);
printf ("*************************************************************************\n");
printf ("Discount is:$ %d\n", discount(cost));
printf ("After discount:$ %d\n", after_discount);
printf ("Tax is :$ %d\n", tax (total));
printf ("Total Amount to be paid:$ %.2f", after_tax);
getch ();
return 0;
}
int discount ( int x)
{
int four_books,discount;
four_books = x * 4;
discount = 0.10*four_books;
return discount;
}
int tax (int y)
{
int tax;
tax = 0.05 *y;
return tax;
}