We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e8674f commit 410ee5aCopy full SHA for 410ee5a
1 file changed
TimeSwap.cpp
@@ -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