What codes should i use here? Thanks.

closed account (L1USLyTq)
Hi, how will i update the time inputted by the user for 1 seconds?

Second, the user will be inputting a time in military format then i am supposed to make it to 12-hour format. How do i that?

Please guide and help me, thank you very much.
First you need a main entry point for your application:
1
2
3
int main() {
    return 0;
}


Then you have to ask for user input:
1
2
3
4
5
6
7
8
#include <iostream>

...
    char ti[11];
    std::cout << "Please enter time: ";
    std::cin >> ti;
    std::cout << "You entered " << ti << "." << std::endl;
...
closed account (L1USLyTq)
The first question goes like this: user should input time and then i'll update it by 1 seconds.

For example:
Enter time: 2 58 59
Time updated by 1 sec: 2 59 0

Another example for ques 1:
Enter time: 12 59 59
Time updated by 1 sec: 1 0 0

So how do i do that? What codes should i use?

And then for 2nd ques, how do i make the user's input which is a military time, how will i translate it to 12 hour format?


The output should be like this:
Enter military time: 13 56 57
12-hour format of 13 56 57 is: 1 56 57

Something that goes like that?
Topic archived. No new replies allowed.