Skip to content

Commit 3b150c0

Browse files
committed
Reformatting
1 parent d5a9369 commit 3b150c0

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

HackerRank/Algorithms/Easy/Standard-MilitaryTime.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
using namespace std;
44

5-
65
int main() {
7-
string s;
8-
string h;
9-
int hr;
10-
cin>>s;
11-
hr = ((s[0]-'0')*10)+(s[1]-'0');
12-
if(s[8]=='P'&&s[9]=='M'&& hr ==12) cout<<to_string(hr);
13-
else if(s[8]=='P'&&s[9]=='M') cout<<to_string(hr+12);
14-
else if(s[8]=='A'&&s[9]=='M'&&hr==12) cout<<"00";
15-
16-
else cout<< s[0]<<s[1];
17-
18-
19-
for(int i =2;i<8;i++)
20-
cout<<s[i];
21-
cout<<endl;
22-
return 0;
6+
string s, h;
7+
int hr;
8+
cin >> s;
9+
hr = ((s[0] - '0') * 10) + (s[1] - '0');
10+
if (s[8] == 'P' && s[9] == 'M' && hr == 12)
11+
cout << hr;
12+
else if (s[8] == 'P' && s[9] == 'M')
13+
cout << hr + 12;
14+
else if (s[8] == 'A' && s[9] == 'M' && hr == 12)
15+
cout << 00;
16+
else cout << s[0] << s[1];
17+
18+
for (int i = 2; i < 8; i++)
19+
cout << s[i];
20+
cout << endl;
21+
return 0;
2322
}

0 commit comments

Comments
 (0)