this is what i got...can anyone help integrating the formula suggested into this.........? to make it simpler.....? #include using std::cout; using std::cin; using std::endl; int main () { int time(int,int,int); int h,h2; // 0-23 int m,m2; // 0-59 int s,s2; // 0 -59 cout <<"Please enter 2 times: "<> h; cout <<"enter minute for the 1st time: "<> m; cout <<"enter seconds for the 1st time : "<> s; cout <<"Please enter the 2nd time: "<> h2; cout <<"enter minute for the 2nd time: "<> m2; cout <<"enter seconds for the 2nd time : "<> s2; cout <<"According to the times entered,"<< endl; cout<<"the difference between the two times in seconds is "<12) min = hh * 60; sec = min * 60; //converts hours to seconds if (mm>0) sec2 = mm * 60; //converts minutes to seconds int x = sec + sec2+ss; //total seconds return x; //returns total seconds
C
compu2rbloo
@compu2rbloo
Posts
-
a FUNCTION 2 CALCULATE SECONDS since time struck 12 -
a FUNCTION 2 CALCULATE SECONDS since time struck 12Hi...newbie here...yes it smells like an assignment but please if anyone can help with a formula on how to get this one. My head is spinning....i've only got the inputs and im suppose to create a function not use the ones in the standard library.......pleasssse help with anything...................something...... ^^^^^^^^^^^^^^^^ Write a function that takes the time as three integer arguments (hours, minutes and seconds) and returns the number of seconds since the last time the clock “struck 12.” Use this function in a program to calculate the amount of time in seconds between two times, both of which are within one 12-hour cycle of the clock.