Skip to content

Commit 410ee5a

Browse files
authored
Add files via upload
1 parent 2e8674f commit 410ee5a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

TimeSwap.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
int main()
5+
{
6+
string time;
7+
string type = time.substr(6, 2);
8+
string y;
9+
string i = time.substr(0, 2);
10+
// cout << " enter time like this : HH:MM-XX" << endl;
11+
//cout << "XX = AM/PM " << endl;
12+
//cin >> time;
13+
if (type == "AM")
14+
{
15+
cout << time << endl;
16+
}
17+
else if (type == "PM")
18+
{
19+
int x = stoi(i);
20+
x = x + 12;
21+
string y = time.erase(0, 2);
22+
cout << x << y << endl;
23+
}
24+
return 0;
25+
}

0 commit comments

Comments
 (0)