Advertisement
legendmt25

Untitled

Dec 3rd, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string time;
  8.     cin >> time;
  9.     if(time[0]=='1' && time[0] == '2')
  10.     {
  11.         if(time[time.length()-2] == 'A' )
  12.         {
  13.             time[0] = time[1] = '0';
  14.         }
  15.        
  16.     }
  17.     else
  18.     {
  19.         int x = ((time[0]-'0')*10) + (time[1]-'0');
  20.         x += 12;
  21.         if(x == 24)
  22.             x = 0;
  23.         time[0] = ((x/10)%10) + '0';
  24.         time[1] = (x%10) + '0';
  25.     }
  26.     for(int i = 0; i < time.length()-2 ; i++)
  27.             cout << time[i];
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement