zoukankan      html  css  js  c++  java
  • C#作业处理

    2019.9.8

    作业要求:

    将字符串加密,即将字符串中每个字符向后移动五个字符,并输出密文

    解决方案:

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace AfterClassDemo
     8 {
     9     class Program
    10     {
    11         static void Main(string[] args)
    12         {
    13             string s = "Thursday is my lucky day!!!";
    14             string s1 = null;
    15             int i = 0;
    16             
    17             //作业:以密文形式输出字符串(向后移动五个字符)
    18             for(;i < s.Length ;i++ )
    19             {
    20                 s1 = Convert.ToString(Convert.ToChar(Convert.ToInt32(s[i]) + 5));
    21                 Console.Write(s1);
    22             }
    23             Console.ReadLine();
    24         }
    25     }
    26 }

    运行结果:

    解题思路:

    第一步:将字符串中字符转化为数字,向后移动五位

    第二步:将数字转化为字符

    第三步:将字符转化为字符串

  • 相关阅读:
    如何引用webservice
    oracle TNS 无法启动 解决方案
    android 照相
    Nutch 运行错误
    XML Bitmap
    Level List
    hadoop hdfs 上传下载文件
    Layer List
    android popup
    [置顶] Clean Talk
  • 原文地址:https://www.cnblogs.com/error203/p/11484489.html
Copyright © 2011-2022 走看看