母婴产品在哪个网站好:有关C#的问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/28 02:54:35
大家好,我是一个刚刚学C#的菜鸟,我有两个问题想问一下各位:

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.WriteLine(input.Replace("no", "yes"));
}
}
}

不知道你说的参数不理解是怎么个不理解?要讲哪方面?

在网上就能查到,有c#的网站