Thread: ???please help

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    2

    Question ???please help

    This is the program I wrote. I cannot figure out what the error is? The compiler says missing function header (old-style formal list). I have no idea what this means.
    //Brendan anderson
    //sales tax

    Code:
    #include <iostream>
    using namespace std;
    int main (); 
    {
    float total tax;
    total tax = $52 * .06;
    cout << The total tax on a 52 dollar purschase is <<total tax<< end1;
    retturn 0;
    }

    Code Tags added by kermi3

  2. #2
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    2 things:
    First of all please use code tags in the future...I added them for you this time, but in the future you do it....people are much more likely to help you if you do.
    Info on code tags:

    http://www.cprogramming.com/cboard/s...threadid=13473


    Second: try adding:

    #include <stdlib.h>

    to your includes.
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    2

    function header

    include <stdlib.h> did not work. Any other sugestions?

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    14
    I hope these 2 errors are there by mistake:

    1)

    float total tax;

    Here you declare two variables of type float, one called total, and the other called tax. You will need to rename this to something like totalTax or total_tax.

    2)

    total tax = $52 * .06;

    You can't have a dollar sign here.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    ...and to add to the list of typos:
    >retturn 0;
    ... is wrong!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    And you forgot your double quotes around the string, and its endl not end1 - it stands for endline and I removed a ; after main(). The code should look like:
    Code:
    #include <iostream>
    using namespace std;
    int main () 
    {
       float totaltax;
       totaltax = 52 * 0.06;
       cout << "The total tax on a 52 dollar purschase is" <<totaltax<< endl;
       return 0;
    }
    Couldn't think of anything interesting, cool or funny - sorry.

  7. #7
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    nothing code related, but its "purchase" not "purschase".

    also, try <iostream.h>. its what i use.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  8. #8
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    damn i might be getting some competetion
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  9. #9
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by Klinerr1
    damn i might be getting some competetion
    ... especially if you carry on making posts with only one mistake!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  10. #10
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by bennyandthejets
    also, try <iostream.h>. its what i use.
    NO
    hello, internet!

  11. #11
    Registered User
    Join Date
    May 2002
    Posts
    11
    -----------------------------
    int main (); <- There's your problem!
    -----------------------------

    When you put a semi-colon at the end of any function you get the error message "old-style header".
    Since I am assuming that you don't have a header file all you have to do is remove the semi-colon.

Popular pages Recent additions subscribe to a feed