#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int h;
string s1;
getline(cin,s1);
cout<<s1;
h=10*(s1[0]-'0')+1*(s1[1]-'0');
cout<<h;
}
}
I gave below as input
1
11:01 PM
got this as output
-560
I want to convert the hour part of the time from string to int.