MahmudulMaruf

Code · Faith · Curiosity

Blog Post

Beecrowd 1253 - Caesar Cipher Solution

cpp �� 2021-12-14 11:48:06

cpp

#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, i, n, t, ascii;
char str[50];
cin>t;
while(t--)
{
cin>str;
        cin>n;
        a=strlen(str);
        for(i=0; i<a; i++)
        {
            ascii=str[i]-n;
            if(ascii<65)
                ascii=91-(65-ascii);
            printf("%c",ascii);
        }
        cout<endl;
    }
    return 0;
}


Post Visited: 67 times

Categories: cpp

0 Comments

    No comments yet. Be the first to comment!

Leave a comment

Captcha