Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string time;
- cin >> time;
- if(time[0]=='1' && time[0] == '2')
- {
- if(time[time.length()-2] == 'A' )
- {
- time[0] = time[1] = '0';
- }
- }
- else
- {
- int x = ((time[0]-'0')*10) + (time[1]-'0');
- x += 12;
- if(x == 24)
- x = 0;
- time[0] = ((x/10)%10) + '0';
- time[1] = (x%10) + '0';
- }
- for(int i = 0; i < time.length()-2 ; i++)
- cout << time[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement