Home Forums C Programming I really need your help!!!

Viewing 1 reply thread
  • Author
    Posts
    • #2034
      sony
      Participant

      Hi all. I’m a beginner to C. And I am writing a program which updates a billing system. I just need any of you to help me check the coding I have made. And I do not have C software on this computer, so I have to do it in college. Please, my dateline is coming. This is the coding…. I would totally appreciate it if you do help me.



      #include
      void readinput(int i)
      void writeoutput(int i)

      main()
      {
      struct date{
      int month;
      int day;
      int year;
      };
      struct account
      {
      char name[80];
      char street[80];
      char city[80];
      int acct_no;
      float previous_balance;
      float current_payment;
      float new_balance;
      struct date lastpayment;
      }
      customer[];
      int i,n;
      printf("CUSTOMER BILLING SYSTEMnn");
      printf("How many customer are there?");
      scanf("%d",&n);

      for(i=0;i {
      readinput(i);
      customer[ i ].new_balance=customer[ i ].previous_balance - customer[ i ]current_payment;
      };

      for(i=0;i
      writeoutput(i);
      }
      void readinput(int i)
      {
      printf("Customer no.%dn",i+1);

      printf(" Name:");
      scanf("%[^n]",customer[ i ].name);
      printf(" Street:");
      scanf("%[^n]",customer[ i ].street);

      printf(" City:");
      scanf("%[^n]",customer[ i ].city);

      printf(" Account number:");
      scanf("%d",&customer[ i ].acct_no);

      printf(" Current payment:");
      scanf("%f",&customer[ i ].currentpayment);

      printf(" Payment date (mm/dd/yyyy):");
      scanf("%d%d%d",&customer[ i ].lastpayment.month,&customer[ i ].lastpayment.day,&customer[ i ].lastpayment.year);,

      return;
      }

      void writeoutput(int i);
      {
      printf("nName: %s",customer[ i ].name);
      printf(" Account number:%dn",customer[ i ].acct_no);
      printf("Street: %sn",customer[ i ].street);
      printf("City %snn",customer[ i ].city);
      printf("Previous Balance: %7.2f",customer[ i ].previousbalance);
      printf(" Current Payment: %7.2f", customer[ i ].currentpayment;
      printf(" New balance: %7.2fnn",customer[ i ].newbalance);
      return;
      }

    • #3280
      denco
      Participant

      oh dear its too long no!

      its ok what i thought was ur programme is correct
Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.