Thread: Error help PLEASE!!!!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    2

    Error help PLEASE!!!!!

    I'm fairly new to programming & I keep getting this error "error C2447: '{' : missing function header (old-style formal list?)" & I have no clue how to fix it if somebody could please help me I'd really appreciate it. Thanks

    I don't know how to tell what line the error is in so i put in all the code & all the error results.

    //************************************************** *******************
    //TITLE Lab 3.2
    //FILENAME: Lab 3.2.cpp
    //RELATED FILES(S) None
    //PREPARED FOR: CS115
    //PROFESSOR: Professor Larry Thomison
    //DESIGNER: Darrick Mohl
    //DEVELOPMENT DATE: 8/1/07
    //COMPILER USED: Microsoft Visual 2005
    //================================================== =================
    // REVISION HISTORY
    // List revisions made to the program (if applicable)
    // DATE PROGRAMMER DESCRIPTION OF CHANGES MADE
    // 4/4/00 Porter Version 2.0
    // 6/27/04 Johnson Version 3.0
    //************************************************** *********************************
    // THE BEGINNING OF THE PROGRAM
    //************************************************** *********************************

    #include <iostream> //tells which library that is used
    #include <cmath>

    using namespace std;

    float calculateCharges (float cost);

    void main() //the initializing of the main body of the program

    {
    float hour1, hour2, hour3, charge1, charge2, charge3, time, h_total, c_total;

    cout<< "Enter the hours for car 1: " << endl;
    cin>> hour1;

    cout<< "Enter the hours for car 2: " << endl;
    cin>> hour2;

    cout<< "Enter the hours for car 3: " << endl;
    cin>> hour3;

    charge1=calculateCharges(hour1);

    charge2=calculateCharges(hour2);

    charge3=calculateCharges(hour3);

    h_total=hour1+hour2+hour3;

    c_total=charge1+charge2+charge3;

    cout<< "Car "<< "Hours " << "Charge" << endl;
    cout<< "1 " << hour1 << charge1 << endl;
    cout<< "2 " << hour2 << charge2 << endl;
    cout<< "3 " << hour3 << charge3 << endl;
    cout<< "TOTAL " << h_total << c_total << endl;

    return;
    }

    float calculateCharges (float cost);
    {
    if (time <= 3);
    cost=2;
    return (cost);
    if (time > 3);
    cost=ceil(time-3)*0.5;
    return (cost);
    }


    1>------ Rebuild All started: Project: Lab 3 trial, Configuration: Debug Win32 ------
    1>Deleting intermediate and output files for project 'Lab 3 trial', configuration 'Debug|Win32'
    1>Compiling...
    1>Lab 3 trial.cpp
    1>.\Lab 3 trial.cpp(61) : error C2447: '{' : missing function header (old-style formal list?)
    1>Build log was saved at "file://c:\Documents and Settings\Mine\My Documents\Visual Studio 2005\Projects\Lab 3 trial\Lab 3 trial\Debug\BuildLog.htm"
    1>Lab 3 trial - 1 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
    Last edited by seventh_sage; 08-02-2007 at 02:20 PM. Reason: code added

Popular pages Recent additions subscribe to a feed