Urgent Post'

 string timeInWords(int h, int m) {

map<int,string> mp{
    {1,"One"},{2,"Two"},{3,"Three"},{4,"Four"},{5,"Five"},{6,"Six"},{7,"Seven"},
    {8,"Eight"},{9,"Nine"},{10,"Ten"},{11,"Eleven"},{12,"Twelve"},{13,"Thirteen"},{14,"Fourteen"},{15,"Fifteen"},{16,"Sixteen"},{17,"Seventeen"},{18,"Eighteen"},{19,"Nineteen"},{20,"Twenty"},{21,"Twenty One"},{22,"Twenty Two"},{23,"Twenty Three"},{24,"Twenty Four"},{25,"Twenty Five"},{26,"Twenty Six"},{27,"Twenty Seven"},{28,"Twenty Eight"},{29,"Twenty Nine"},{30,"Thirty"},{31,"Thirty One"},{32,"Thirty Two"},{33,"Thirty Three"},{34,"Thirty Four"},{35,"Thirty Five"},{36,"Thirty Six"},{37,"Thirty Seven"},{38,"Thirty Eight"},{39,"Thirty Nine"},{40,"Fourty"},{41,"Fourty One"},{42,"Fourty Two"},{43,"Fourty Three"},{44,"Fourty Four"},{45,"Fourty Five"},{46,"Fourty Six"},{47,"Fouty Seven"},{48,"Fourty Eight"},{49,"Fourty Nine"},{50,"Fifty"},{51,"Fifty One"},{52,"Fifty Two"},{53,"Fifty Three"},{54,"Fifty Four"},{55,"Fifty Five"},{56,"Fifty Six"},{57,"Fifty Seven"},{58,"Fifty Eight"},{59,"Fifty Nine"},{60,"Sixty"}
};
map<int,string>:: iterator itr=mp.find(h);
if(m==0){
    
    if(m==0){
        return itr->second+"O' Clock"
    }    
}
if(m==15){
return "Quarter Past "+itr->second;
}
if(m==30){
    return "Quarter Past "+itr->second;
}
return "String";
}

Comments

Popular Posts