If you say you are going to pass (int,*int,*int,*int) and not giving default arguments, you cant simply get away with just passing a single int
Try this;
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*); // " " "
void Sec_To_HMSTime(int,int*,int*,int*); //" " "
int main()
{
int hr,min,sec,seconds;
//char another;
int total_sec, choice;
cout << endl << "Welcome to a time-conversion program!" << endl << endl;
do{
cout << endl << "Please pick a choice:"
<< endl << "1) Convert H:M:S to seconds."
<< endl << "2) Convert seconds to H:M:S."
<< endl << "3) Exit." << endl << endl;
cin>>choice;
switch(choice){
case 1:
GetTime(&hr,&min,&sec);
total_sec=CalcSeconds(hr,min,sec);
cout << endl << "You Entered " << hr << ":" << min << ":" << sec;
cout << endl << "It is " << total_sec << " seconds "<< endl;
break;
case 2:
GetSeconds(&seconds);
Sec_To_HMSTime(seconds,&hr,&min,&sec);
cout << endl << "You Entered " << seconds;
cout << endl << "It is "<< hr <<":"<< min << ":" << sec ;
break;
case 3:
cout << endl << "Test3"<< endl << endl;
break;
default:
cout<<"\nThat's not a valid choice!";
}
}while(choice !=3);
cout << endl << "Bye!" << endl << endl;
cout << endl << "Thanks for playing!"<< endl;
return 0;
}
void GetTime(int *h_ptr,int *m_ptr, int *s_ptr)
{
char colon;
while(1)
{
cout << endl << "Please enter the time in hours minutes seconds "
<< endl <<"Such as 4:15:34 (Note: Minutes and Seconds < 60 )"
<< endl << endl << "==>";
cin >> *h_ptr >> colon >> *m_ptr >> colon >> *s_ptr;
if(*m_ptr > 59 || *s_ptr > 59)
{
cout << endl << "WHOA!!! Invalid Time!!! ";
}
else break;
}
}
void GetSeconds(int *sec)
{
cout<< endl << "Please enter the number of seconds" << endl;
cin >> *sec ;
}
int CalcSeconds(int hr, int min, int sec)
{
return hr*3600 + min*60 + sec;
}
void Sec_To_HMSTime(int h_m_s, int *hr, int *min, int *sec)
{
*hr = h_m_s / 3600;
h_m_s = h_m_s % 3600;
*min = h_m_s / 60;
h_m_s = h_m_s % 60;
*sec = h_m_s;
}
<edit>..beaten to it ! </edit>