C#编程 题, 请帮忙做下, 谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/23 20:41:45
1、请将以下英文句子:you are a fool !!! 单词单行输出:
2、请用IF语句和for语句来编写主程序:输入happy的英文单词,判断正确与否,正确回答真棒!否则回答错误。
3、请编写输出数组1, 2, 7, 5,6,8,4,9 的最小值的主程序。

三题写一起了
class Program
{
static void Main(string[] args)
{
Console.WriteLine("you are a fool !!!");
string a = Console.ReadLine();
if (a == "happy")
{
Console.WriteLine("真棒!");
}
else
Console.WriteLine("错误!");
int[] arr = { 1, 2, 7, 5, 6, 8, 4,9};
int t;
for (int i = 0; i < 8; i++)
{
for (int j = i + 1; j < 8; j++)
{
if (arr[i] > a[j])
{
t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
}
}
Console.WriteLine(arr[0]);
}