zoukankan      html  css  js  c++  java
  • 1.11

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace _1._1
    {
        class Program
        {
            static void Main(string[] args)
            {
                int i;
                string s_text, s_key, s_result="";
                char ch;                                                //定义变量
                Console.WriteLine("请输入原字符串");
                s_text = Console.ReadLine();                            //输入s_text 
                Console.WriteLine("请输入秘钥字符串");
                s_key = Console.ReadLine();                              //输入s_key
                if (s_text.Length != s_key.Length)                       //判断长度是否相等
                    Console.WriteLine("秘钥字符串与原字符串长度必须相等");
                else
                {
                    for (i = 0; i < s_text.Length; i++)                  //使用for语句及异或运算符 ^ 进行加密
                    {
                        ch = s_text[i];
                        s_result += (char)(ch ^ s_key[i]);
                    }
                    Console.WriteLine("加密后字符串为:");
                    Console.WriteLine(s_result);                          //输出加密后的结果
                    Console.WriteLine("按回车键结束");
                    Console.ReadLine();
                }
            }
        }
    }
  • 相关阅读:
    【POJ 2778】DNA Sequence
    【POJ 2923】Relocation
    codeforces 475D
    hdu4742
    hdu4741
    hdu5016
    poj3929
    Codeforces Round #267 (Div. 2)
    codeforces 455E
    hdu4073 Lights
  • 原文地址:https://www.cnblogs.com/xx--/p/7589089.html
Copyright © 2011-2022 走看看