You are viewing a single comment's thread. Return to all comments →
Here is my c++ code
string timeConversion(string s) { string hour= s.substr(0,2); string ms= s.substr(2,6); string meridian= s.substr(8,2); int clock = stoi(hour); if(meridian=="AM") { if(clock==12) { hour="00"; } } else if(meridian =="PM") { if(hour!="12") { clock+=12; hour =to_string(clock); } } return hour+ms; }
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
Here is my c++ code