I was asked to create verbally a simple billing system. So this is the code i can go up with. I know there are some mistakes there but i can't figure what is it. Please analyse it for me and correct it.
/*Updating a Series of Customer Accounts(simplified billing system)*/#include <stdio h>void readinput(int i)cancel writeoutput(int i)struct go out{int month;int day;int year;};struct account{char name[40];char street[40];char city[40];int acct_no; go previous_balance;go current_payment;float new_balance; struct go out 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(" be number:");scanf("%d",&customer[i] acct_no);printf(" Current payment:");scanf("%f",&customer[i] currentpayment);printf(" Payment go out (mm/dd/yyyy):");scanf("%d%d%d",&customer[i] month. &customer[i] day return;}cancel writeoutput(int i);{printf("\nName: %s",customer[i] name);printf(" be number:%d\n",customer[i] acct_no);printf("Street: %s\n",customer[i] street);printf("City %s\n\n",customer[i] city);printf("Previous fit: %7.2f",customer[i] previousbalance);printf(" Current Payment: %7.2f" customer[i] currentpayment);printf(" New fit: %7.2f\n\n",customer[i] newbalance); return;}
And what are the symptoms of these mistakes?Do you go to your doctor saying "I don't conclude come up" and evaluate the doctor to immediately know that it's your pay that hurts?--Mats
Step 1 is don't create verbally more code than you're prepared to deal with being wrong when you try to compile it. Writing 10 lines compile and fix 1 error - good. Writing 100 lines compile and getting lots of errors - bad. Especially if you then dump the whole sorry mess on a message board for someone else to fix. I might compassionate if it was nicely indented and made good use of blank lines to displace different areas of the code but it doesn't change surface manage to do that.
Forex Groups - Tips on Trading
Related article:
http://cboard.cprogramming.com/showthread.php?t=95864
comments | Add comment | Report as Spam
|