SHARE
TWEET

Untitled

legendmt25 Dec 3rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top