I was asked to write a simple billing system. So this is the code i can come up with. I know there are some mistakes there but i can't figure what is it. Please, check it for me and correct it.
Code:/*Updating a Series of Customer Accounts(simplified billing system)*/ #include <stdio.h> void readinput(int i) void writeoutput(int i) struct date{ int month; int day; int year; }; struct account { char name[40]; char street[40]; char city[40]; int acct_no; float previous_balance; float current_payment; float new_balance; struct date lastpayment; } customer[100]; main() { int i,n; printf("CUSTOMER BILLING SYSTEM\n\n"); printf("How many customer are there?"); scanf("%d",&n); { readinput(i); customer[i].new_balance=customer[i].previous_balance-customer[i]current_payment; } writeoutput(i); } void readinput(int i) { printf("Customer no.%d\n",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].month, &customer[i].day, return; } void writeoutput(int i); { printf("\nName: %s",customer[i].name); printf(" Account number:%d\n",customer[i].acct_no); printf("Street: %s\n",customer[i].street); printf("City %s\n\n",customer[i].city); printf("Previous Balance: %7.2f",customer[i].previousbalance); printf(" Current Payment: %7.2f", customer[i].currentpayment); printf(" New balance: %7.2f\n\n",customer[i].newbalance); return; }



LinkBack URL
About LinkBacks


