有关C#的问题
来源:百度知道 编辑:UC知道 时间:2024/05/12 18:32:30
1、编写一个控制台应用程序,它接收用户输入的一个字符串,将其中的字符以与输入相反的顺序输入
2、编写一个控制台应用程序,它接收一个字符串,用“yes”替换字符串中所有的"no"。
另外定义函数中的输入参数不是很理解,希望各位能帮忙解释一下!~
希望各位大侠不吝赐教!~~`
谢谢!~
1.
using System;
using System.Collections.Generic;
using System.Text;
namespace answer
{
class Program
{
static void Main(string[] args)
{
string input = System.Console.ReadLine();
char[] chars = input.ToCharArray();
for (int i = 0; i < input.Length/2; i++)
{
char temp = chars[i];
chars[i]=chars[input.Length-i-1];
chars[input.Length - i - 1] = temp;
}
System.Console.WriteLine(chars);
}
}
}
2.
using System;
using System.Collections.Generic;
using System.Text;
namespace answer
{
class Program
{
static void Main(string[] args)
{
string input = System.Console.ReadLine();
Console.WriteLi