Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: None  |  size: 1.21 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. void displayInformation(struct cashier s);
  5. void displayTotal(struct grocery g);
  6.  
  7. typedef struct cashier{
  8.         char firstname[50];
  9.         char lastname[50];
  10.         char time_in [10];
  11. }CASHIER;
  12.  
  13.  
  14.  
  15. typedef struct grocery{
  16.         int item_no;
  17.         char item_desc [50];
  18.         int qty;
  19.         float amount;
  20.  
  21. }GROCERY;
  22.  
  23. int main() {
  24.         CASHIER c;
  25.         GROCERY g;
  26.  
  27.         printf("\nEnter firstname:");
  28.         scanf("%s",c.firstname);
  29.         printf("\nEnter lastname:");
  30.         scanf("%s",c.lastname);
  31.         printf("\nEnter time in:");
  32.         scanf("%s",c.time_in);
  33.  
  34.         displayInformation(c);
  35.  
  36.         printf("\n\nEnter item no. :");
  37.         scanf("%d",&g.item_no);
  38.         printf("\nEnter item description:");
  39.         scanf("%s",g.item_desc);
  40.         printf("\nEnter qty:");
  41.         scanf("%d",&g.qty);
  42.         printf("\nEnter amount:");
  43.         scanf("%.2f",&g.amount);
  44.        
  45.        
  46.         displayTotal(g);
  47.  
  48.         system("pause");
  49.  
  50. }
  51.  
  52.  
  53. void displayInformation(struct cashier c){
  54.  
  55. printf("\nFirstname:%s",c.firstname);
  56. printf("\nLastname:%s",c.lastname);
  57. printf("\ntime in:%s",c.time_in);
  58.  
  59. }
  60.  
  61.  
  62. void displayTotal(struct grocery g){
  63.        
  64.         printf("\nItem no.:  %d ",g.item_no);
  65.         printf("\nItem description:  %s ",g.item_desc);
  66.         printf("\nquantity:  %d ",g.qty);
  67.         printf("\namount:  %.2f ",&g.amount);
  68.        
  69.         }