Ive been given a task to create a program that will create a clock that can be incremented at users request. Ive always had a few problems when functions are involvec. So far in my program i just want to do a function that will add 1 to the value for seconds and i want the changes to occur in main too. Can someone show me where im going wrong?
#include <iostream.h>
#include <cstring.h>
struct ClockType
{
int iHours;
int iMinutes;
int iSeconds;
}; //End Struct
////////////////////////////////////////////////////////////////////////////////
//Function Prototypes
AddTime();
////////////////////////////////////////////////////////////////////////////////
void main(void)
{
int iYes;
ClockType sClock;
cout << "Enter the time" <<endl;
cout << "What is the hour? ";
cin >> sClock.iHours;
cout << "Enter the minute " <<endl;
cin >> sClock.iMinutes;
cout << "Enter the seconds " <<endl;
cin >> sClock.iSeconds;
cout <<"The time is " << sClock.iHours <<":"
<< sClock.iMinutes << ":" << sClock.iSeconds <<endl;
cout <<"Press 1 to change time";
cin >> iYes;
if (iYes == 1);
{
AddTime(int ClockType sClock);
{
sClock.iSeconds = sClock.iSeconds +1;
return sClock;
}
else
{
cout << "Time not changed"
}
}
}
}//End main