TOPIC

100% wrong though i am getting correct answers

Mahdi Mohammad Shibli asked 2 years ago

include include

using namespace std;

int main(){ string t;

getline(cin, t);

for(int i=0; i<t.size(); i++){

    int g = 0, h = 0;

    g = t[i];

    if(t[i] >=97 && t[i] <= 122){

        g = t[i] + 13;

        if(g > 122){

            h = g - 122;

            t[i] = 97 + h - 1;

        }
        else{

            t[i] = g;}

        }

    else if(t[i] >= 65 && t[i] <= 90){

        g = t[i] + 13;

        if(g > 90){

            h = g - 90;

            t[i] = 65+ h - 1;

        }
        else{

            t[i] = g;

        }

    }

}

cout<<t<<endl;

return 0;

}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.