1. ## help loll

well im trying to do this but i cant

first i make a class in c++ and then pass values to it from main function of time

lets say i pass 3:26:12 ..

3 = hour
26 = min
12 = sec

so it displays it fine.. but now i want abit change in it.. i want if i pass 3:65:12 to it so it should automaticaly make it 4:05:12 as we know tht 1 hour = 60 mins..

so any logic for that? thanks buddies in advance

2. Yes. In fact you have the logic in your post.

(In other words, what exactly is your question?)

3. loll!

4. ok let me explain again lol..

once the program is executed, iit will ask u to set a time..

if u enter => 3:25:10 it will display it as follows

The Time is 3:25:10

in this, 3 = hour .. 25 = minutes .. 10 = seconds .. i hope this is very clear

now i wnt if someone enter's => 3:65:10 ... it means 3 = hour ... 65 = minute .. 10 = second.. we know that 1 hour has 60 minutes.. so minutes CANNOT BE MORE THAN 60 else the time will change to 4.. so with this logic it should be 4:05:10 .. now i hope this is very clear.. i need the logic for this..... i tried but couldnt get it

5. So, what have you tried, and how is the result different from what you expect?

--
Mats

6. as i said, i dont know the logic.. i can write the code if u can tell me the logic mtsp

7. Originally Posted by salmansalman
as i said, i dont know the logic.. i can write the code if u can tell me the logic mtsp
You know the logic -- how else did you get the answer 4:05:10? (Whatever you did to get that answer -- that's the logic.)

8. i dont know what to do to get the answer, thats the problem.. i know what it should be but i dont know HOW it should be.. by logic i meant i dont know the mathematical logic for it

9. You said the minutes can't be more than 60. So: IF the minutes are more than 60, you need to fiddle. How did you get 4 and 05 out of 3 and 65?

Edit: And continuing that idea, what should happen to 3:83? What about 11:64? What about 12:72?

10. i did if(min>60)
cout<<"Invalid input";
looool thats the easy escape =[ n i dont know do i need to use ifs or what man.. cant u write the logic code here?

11. If your using a class, ensure the members are a default state ( zero ) to begin. As each time is entered, use a function that checks the validitlity of the value, and enusre it never goes over 60, if it does, print an error and quit, or get the function to set it to a default value.

As for printing the time, use getter functions to return the valid time values seperated by the colon.

12. This has just *got* to be a joke...really, seriously. Epic lulz, right? ROFLcopter, all that?

13. Originally Posted by salmansalman
i did if(min>60)
cout<<"Invalid input";
looool thats the easy escape =[ n i dont know do i need to use ifs or what man.. cant u write the logic code here?
No. (I can write the logic code, but I can't write the logic code here, in that that would waste my time and enable your behavior. And don't ask me in a PM or email either.)

If you don't understand the logic well enough to at least get a flowchart or pseudocode out of it, then showing you C++ isn't going to help you. Show us that you understand what's going on, and we can help with the details.

14. thanks for the lecture, i dont hve time to read tht much useless paragraphs full of arrogant lines.. ill figur it out myself, cya.. thts all for now
bye

15. Although everything tabstop said was perfectly valid. Nobody will write an entire program for you, if you start the program then post it in regaurds to any errors people can help you.