Caesar encryption algorithm

Source: Internet
Author: User

// Project name: Kaisa
// File name: Kaisa. cpp
// Function: demonstrate the Caesar encryption algorithm
// Dependent file: None

# Include <iostream>
# Include <string>
Using namespace STD; // use a string. # include <iostream. h> cannot be used;

Void Kaisa (string S, int K)
...{
Char T [10];
T [0] = S. Length () + 1;
For (INT I = 0; I <S. Length (); I ++)
T [I + 1] = (s [I]-97 + k) % 26 + 97;
For (I = 1; I <t [0]; I ++)
Cout <t [I];
Cout <Endl;
}
Void main ()
...{
String S;
Int K = 0;
Cout <"Enter the English string to be encrypted (do not include spaces and symbols ):";
Cin> S;
Cout <"Enter the key (Arabic numerals ):";
Cin> K;
Cout <"the encrypted string is :";
Kaisa (S, k );

}

 

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.