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();
                }
            }
        }
    }
  • 相关阅读:
    LQB201803乘积尾零
    最大公约数
    快速幂运算
    二分法查找原理
    递归-24点
    递归-爬楼梯
    递归-中项表达式求解
    IDEA的安装基本使用
    SSM和开源框架 ------面试指导
    JDK 8 新特性
  • 原文地址:https://www.cnblogs.com/xx--/p/7589089.html
Copyright © 2011-2022 走看看