Study of structures - 6.

#include <stdio.h>

typedef struct item
{
int code;
char name[40];
float price;

struct
{
int purchased, buffer;
}stock;
}item;

int main(void)
{
item soap;

soap.code = 1001;
strcpy(soap.name, "Rin Supreme");
soap.price = 7.5;
soap.stock.purchased = 1000;
soap.stock.buffer = 700;

printf("\nCode\tName\t\tPrice\t\tQuantity sold\n");
printf("\n%d\t%s\t%f\t%d", soap.code, soap.name, soap.price,
soap.stock.purchased - soap.stock.buffer);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin