600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > C#学习笔记之-----倒序输出字符串

C#学习笔记之-----倒序输出字符串

时间:2023-07-26 03:21:54

相关推荐

C#学习笔记之-----倒序输出字符串

为什么80%的码农都做不了架构师?>>>

学习C#写的第一个程序,很简单啊,以后的代码都放在OSChina上了,VS升级u2后,github上说不定也有了哈。开发工具是VSE 。

下面是代码,太简单,没有注释。

#region importusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;#endregionnamespace CSharpStudy{class ReverseString{public static void Main(String[] args){Console.Write("请输入一个字符串:");String str = Console.ReadLine();if (str == null)return;String result = "";for (int index = str.Length - 1; index >= 0; index--){result += str[index];}Console.WriteLine("倒序的字符串是 {0}", result);Console.ReadKey();}}}

PS:看到一堆的using不舒服,所以…………。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。