Please check this coding for me!

This is a discussion on Please check this coding for me! within the C Programming forums, part of the General Programming Boards category; I was asked to write a simple billing system. So this is the code i can come up with. I ...

  1. #1
    Join Date
    Oct 2007

    Please check this coding for me!

    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.

    /*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;	
    	int i,n;
    	printf("CUSTOMER BILLING SYSTEM\n\n");
    	printf("How many customer are there?");
    void readinput(int i)
    	printf("Customer no.%d\n",i+1);
    	printf("   Name:");
    	printf("   Street:");
    	printf("   City:");
    	printf("   Account number:");
    	printf("   Current payment:");
    	printf("   Payment date (mm/dd/yyyy):");
    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);

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    And what are the symptoms of these mistakes?

    Do you go to your doctor saying "I don't feel well" and expect the doctor to immediately know that it's your foot that hurts?

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    A development process
    Step 1 is don't write 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 care if it was nicely indented and made good use of blank lines to separate different areas of the code, but it doesn't even manage to do that.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. how to check input is decimal or not?
    By kalamram in forum C Programming
    Replies: 3
    Last Post: 08-31-2007, 07:07 PM
  3. Replies: 3
    Last Post: 07-24-2007, 04:25 PM
  4. Please check this loop
    By Daesom in forum C++ Programming
    Replies: 13
    Last Post: 11-02-2006, 12:52 AM
  5. check my code ( if statement, file existance )
    By Shadow in forum C Programming
    Replies: 1
    Last Post: 10-04-2001, 11:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21