
Untitled
By: a guest on
May 26th, 2012 | syntax:
None | size: 1.21 KB | hits: 13 | expires: Never
#include<stdio.h>
#include<stdlib.h>
void displayInformation(struct cashier s);
void displayTotal(struct grocery g);
typedef struct cashier{
char firstname[50];
char lastname[50];
char time_in [10];
}CASHIER;
typedef struct grocery{
int item_no;
char item_desc [50];
int qty;
float amount;
}GROCERY;
int main() {
CASHIER c;
GROCERY g;
printf("\nEnter firstname:");
scanf("%s",c.firstname);
printf("\nEnter lastname:");
scanf("%s",c.lastname);
printf("\nEnter time in:");
scanf("%s",c.time_in);
displayInformation(c);
printf("\n\nEnter item no. :");
scanf("%d",&g.item_no);
printf("\nEnter item description:");
scanf("%s",g.item_desc);
printf("\nEnter qty:");
scanf("%d",&g.qty);
printf("\nEnter amount:");
scanf("%.2f",&g.amount);
displayTotal(g);
system("pause");
}
void displayInformation(struct cashier c){
printf("\nFirstname:%s",c.firstname);
printf("\nLastname:%s",c.lastname);
printf("\ntime in:%s",c.time_in);
}
void displayTotal(struct grocery g){
printf("\nItem no.: %d ",g.item_no);
printf("\nItem description: %s ",g.item_desc);
printf("\nquantity: %d ",g.qty);
printf("\namount: %.2f ",&g.amount);
}