Hi,
I have something wrong with some code that I'm trying to write.
The error message said "function does not take 1 parameters"
I'm using Visual C++ 6.0 and the MSDN Library states that I'm calling with incorrect number of parameters. The message occurs on the second line in the Switch case #2. It has something to do with the Sec_To_HMSTime prototype. (I think) I would appreciate it greatly if someone could help me locate the problem. Another set of eyes usually always helps! Thanks, mcorn.
tot_sec=Sec_To_HMSTime(seconds);Code:#include<iostream.h> #include<stdlib.h> void GetTime(int*,int*,int*); int CalcSeconds(int,int,int); bool CheckInput(int*,int*); //new function protocol void GetSeconds(int*); // " " " int Sec_To_HMSTime(int,int*,int*,int*); //" " " int main() { int hr,min,sec,seconds; //char another; int total_sec, tot_sec, choice; cout<<"\n\nWelcome to a time-conversion program! \n\n"; do { cout<<"\nPlease pick a choice:" <<"\n1) Convert H:M:S to seconds." <<"\n2) Convert seconds to H:M:S." <<"\n3) Exit." << endl << endl; cin>>choice; switch(choice) { case 1: GetTime(&hr,&min,&sec); total_sec=CalcSeconds(hr,min,sec); cout<<"\n\nYou Entered " << total_sec << " seconds "; cout<<"\nIt is " << total_sec << " seconds "<<endl; break; case 2: GetSeconds(&seconds); tot_sec=Sec_To_HMSTime(seconds); cout<<"\nYou Entered" << tot_sec; cout<<"\nIt is"<<hr<<":"<<min<<":"<<sec; break; case 3: cout<<"\nTest3"<< endl << endl; break; default: cout<<"\nThat's not a valid choice!"; } }while(choice !=3); cout<<"\nBye!"<<endl<<endl; cout<<"\nThanks for playing! \n"; return 0; } void GetTime(int *h_ptr,int *m_ptr, int *s_ptr) { int ask_them_again = 1; char colon; while(ask_them_again == 1) { cout<< "\n Please enter the time in hours minutes seconds " << "\n Such as 4:15:34 (Note: Minutes and Seconds < 60 ) \n\n==>"; cin>> *h_ptr >> colon >> *m_ptr >> colon >> *s_ptr; ask_them_again = 0; if(*m_ptr > 59 || *s_ptr > 59) { cout << "\n WHOA!!! Invalid Time!!! "; ask_them_again = 1; } } } int CalcSeconds(int hr, int min, int sec) { int total_sec; total_sec = hr*3600 + min*60 + sec; return total_sec; } int Sec_To_HMSTime(int h_m_s, int *hr, int *min, int *sec) { int total_secs; *hr = h_m_s/3600; h_m_s = h_m_s%3600; *min = h_m_s/60; *sec = h_m_s%60; return total_secs; }



LinkBack URL
About LinkBacks


