c++ problem, anyone can help?

Recommended Videos

GeeksUtopia

New member
Feb 26, 2011
259
0
0
[Yeah this program is supposed to give out time, like input a time to start from and counts from there. Anyone can help?]

#include
using namespace std;


int ReadSec(int sec){
return(sec + 1) % 60;
}
int ReadMin(int min){
return(min + 1) % 60;
}
int ReadHr(int hr){
return(hr + 1) % 12;
}

void inchrs(int & hr, int & am){
hr = hr + 1;
if(hr == 12){
hr = 1;
am = !am;
}
}

void ClockTick(int & sec, int & min, int & hr, int & am){

cout << hr << ":" << min << ":" << sec << endl;
if(sec == 0){
min = ReadMin(min);
}
if(min == 0){
ReadHr(hr);
}
}



int main(){

int sec;
int min;
int hr;

sec == ReadSec(sec);
min == ReadMin(min);
hr == ReadHr(hr);



system("Pause");
return 0;
}
 

MidnightCat

New member
Jul 21, 2009
125
0
0
Are you going to be incrementing this clock manually, by 1 second and/or 1 minute?

Also, it might be a good idea for you to look at a guide on coding conventions for C++ (example here [http://geosoft.no/development/cppstyle.html]). It'll make it easier for you, and others, to read your code.
 

burningdragoon

Warrior without Weapons
Jul 27, 2009
1,934
0
0
Related tip for the future. If you are gonna post code on the forums, use the &#91;code&#93;&#91;/code&#93; tags