18th Week OJ test Project 5--Confidential message

Source: Internet
Author: User

The law of a telegraph office's message secrecy is to turn every English letter into a 4th letter (very primitive kind), such as a to e,a into E. The last four letters (W,X,Y,Z or W,X,Y,Z) become the first 4 letters (A,B,C,D or A,B,C,D). Non-alphabetic characters do not change. Enter a line of letters that requires the output of the corresponding encrypted text .

The code is as follows:

#include <iostream> #include <cstdio>using namespace Std;int main () {    char str[100];    int i=0;    Gets (str);    while (str[i]!= ')    {        if ((str[i]>= ' A ' &&str[i]<= ' V ') | | (str[i]>= ' a ' &&str[i]<= ' V '))            str[i]+=4;        else if ((str[i]>= ' W ' &&str[i]<= ' Z ') | | (str[i]>= ' W ' &&str[i]<= ' z '))            str[i]-=22;        ++i;    }    cout<<str;    return 0;}


Operation Result:

Say ashamed, this problem is I in a C language book to see the C language code to C + + code to submit to the teacher, the results of their original code has been submitted on the OJ platform after the display output overrun, crying drunk,, resulting in my last problem also failed to complete in time ... Last night to take these two problems after the early morning to the school room to make up,,, the results in the room outside for half an hour,, in short, this is really a sad story.

18th Week OJ test Project 5--Confidential message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.