Time Strings

I dont know why my program is not giving me desired output :((.
if part is not working when i give a input in AM.
plzzz help

#include
using namespace std;

void convert(string str)
{
int h1 = (int)str[1] - ‘0’;
int h2 = (int)str[0] - ‘0’;
int hh = (h2 * 10 + h1 % 10);
if (str[6] == ‘A’)
{
if (hh == 12)
{
cout << “00”;
for (int i=2; i <= 4; i++)
cout << str[i];
}
else
{
for (int i=0; i <= 4; i++)
cout << str[i];
}
}

else
{
    if (hh == 12)
    {
        cout << "12";
        for (int i=2; i <= 4; i++)
            cout << str[i];
    }
    else
    {
        hh = hh + 12;
        cout << hh;
        for (int i=2; i <= 4; i++)
            cout << str[i];
    }
}

}

int main()
{
string str;
cin>>str;
convert(str);
return 0;
}
// input - 01:22 AM