I have rewritten the code. Now I am getting the following error message:error C2239: unexpected token '{' following declaration of 'main'. Please help.
I am writing a function that will take time as three integer arguments (for hours,minutes, and seconds), and returns the number of seconds since the last time the clock "struck 12". I will then use this function to calculate the amount of time in seconds between two times, both of which are within on 12-hour cycle of the clock. Any advice would be appreciated.
Please use [code][/code]TagsCode:#include <iostream> #define SecondsPerHour 3600 #define SecondsPerMinute 60 #define MinutesPerHour 60 int main { int hh, // hours mm, // minutes ss, // seconds begin_sec, end_sec, // times converted sec_elapsed; // difference between times char colon1, colon2; // read start time printf( "Please enter a start time (HH:MM:SS) --> " ); scanf ( "%d%c%d%c%d", &hh, &colon1, &mm, &colon2, &ss); // convert start time to seconds by calling on function begin_sec = Time_in_Seconds(hh,mm,ss); // read end time printf( "Please enter an end time (HH:MM:SS) --> " ); scanf ( "%d%c%d%c%d", &hh, &colon1, &mm, &colon2, &ss); // calls on function that will convert entered time to seconds end_sec = Time_in_Seconds(hh, mm, ss); // calculate time difference sec_elapsed = end_sec - begin_sec; return (0); }



LinkBack URL
About LinkBacks


