首页 > Windows开发 > 详细

c#字母加密

时间:2018-10-15 23:47:23      阅读:206      评论:0      收藏:0      [点我收藏+]
/*
 * 由SharpDevelop创建。
 * 用户: Administrator
 * 日期: 2018/10/14
 * 时间: 21:07
 * 
 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
 */
using System;

namespace clianxi3
{
	class Program
	{
		public static void Main(string[] args)
		{ 
			string str=Console .ReadLine ();
			string temr1="";
			for (int i = 0; i <str .Length; i++){//便利每一个字符
				if (str [i]>=‘a‘&&str[i]<=‘z‘) {
					int num=str[i];
					num+=3;
					char temp=(char)num;
					temp=(char)(temp-‘z‘+‘a‘-1);
					temr1+=temp;
			}else if (str [i]>=‘A‘&&str[i]<=‘Z‘) {
				int num=str[i];
					num+=3;
					char temp=(char)num;
					if (temp>‘Z‘) {
						temp=(char)(temp-‘Z‘+‘A‘-1);
					}
					temr1+=temp;
				}else{
					temr1+=str[i];
				}
				
			}
			Console.WriteLine(temr1);
			
			// TODO: Implement Functionality Here
			
			Console.Write("Press any key to continue . . . ");
			Console.ReadKey(true);
		}
	}
}

 

c#字母加密

原文:https://www.cnblogs.com/llhhcc/p/9795081.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!