Hi all
any one can help what are my mistakes, this program for a newspaper shop with monthely magazine.
thanks.
# include < stdio.h>
#define Titlelength 20
struct News Record { int code ;
char title[titlelength];
char month[10];
int numordered;
int numsold;
float whole price;
float retail price;
};
void list stock (sruct NewsRecord shop[20]; int c)
int k;
for (k= 0; k<c; k++)
{
pritf ("magazine code number % d",k);
printf ("name %s", magazinename[magazine]);
printf ("name %s", shop[k].name);
printf ("name %s" ,monthname[month]);
printf ("wholeprice £%F",shop[k].sterlingprice;
printf ("retailprice £%F,shop[k].sterlingprice);
printf ( "numsold %d" ,k);
printf ("stock level%d \n",shop[k].stocklevel);
};
}
int sellmagazin(struct magazine shop[20],intc)
{
int many, order. Want;
liststock (shop, c);
do
{
printf ("what do you want!");
scanf (" %d" ,& want) ;
}
while (want >c);
printf ("how many do want!");
scanf ("%d" ,& many);
printf (" please pay £%f", shop [want].sterling price);
if (many ,shop[want].stocklevel)
order=1000;
else
order=want;
shop(want).stocklevel-=many;
return order;
}
void order newsrecord (struct newspaper shop [20],int want)
{
int many;
printf("how many %s do you need",shop[want].name);
shop[want].stoklevel+=many;
}
if (c<20)
{
printf("Enter magazine code number:");
scanf("%d",&code num);
printf("Enter the magazine title:");
scanf("%s", &magazine[20]. title);
printf("Enter the month name:");
scanf("%s", &month[10]. name);
printf("Enter the number to be order:");
scanf("%d",&shop[c].stocklevel);
printf("Enter the number to be sold;
scanf("%d",&shop[c].stocklevel);
printf("Enter whole price of magazine :");
scanf("£%f",&shop[k].sterlingprice);
printf("Enter retail price of magazine:");
scanf("£%f",&shop[k].steringprice);
return 1;
}
else
return 0;
}
void main()
{
struct newsrecord shop[20];
int c=o ;char letter;float profit,sum profit;
do
{
printf("Do you want to O)rder or S)ell L)ist C)alculate profit for each title T)otal;
scanf("%c",&letter);
if ((letter=='O')||(letter=='o'))
{
if(!order magazine title (shop,c++)
printf("you can't order any more\n");
}
else if ((letter=='S')||(letter=='s'))
{
order number=sell magazine(shop,c);
if (order number !=1000)
order magazine(shop,order number);
}
else if ((letter= ='L')||(Letter= ='l')
List stock (shop,c);
}
else if ((letter= ='C')||(letter= ='c'))
{
profit for each title=number sold *(retail price - whole sell price)
printf("profit for each titl=£%f") scanf("£%f",&shop[c].sterling price);
}
else if ((letter= ='T')||(letter= ='t')
for(I=0=sum;I<num -of-title;I++)
sum=sum+profit for each title
printf("sum of profit for each title per day=£%f");
scanf("£%f",&sum);
};
}
}