C++/hi

Advertisement


Question
hi sir how are u.i have dificulty in while usind c++.can u help in a short program??
the program is such like this,,,,,,,,,
Write a function that the time as three integer arguments (ours,minutes and seconds) and returns the number of seconds since the last time the clock "struck 12".use this function to calcuate the amount of time in seconds between two times both of which are within one 12-hour cycle of the clock,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,plz send me quickly .plz.

Answer
Dear sheraz:

Your program will look something like this:

int seconds ( int hours , int minutes , int seconds )
{
 return hours * 60 * 60 + minutes * 60 + seconds ;
}

int SecondsDifference = seconds ( 2 , 23 , 10 ) - seconds ( 1 , 30 , 10 ) ;

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Titus B. Ledbetter, Jr.

Expertise

C , MFC, Object Oriented, Artificial Intelligence

Experience

I have over ten years experience in the field of Computer Science, five years experience developing C/C++. I recently wrote a chess program using Object Oriented, C++, MFC.

Education/Credentials
Master's Degree Computer Science from Johns Hopkins

©2016 About.com. All rights reserved.