using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("欢迎光临本商场" + "\n" + "你今天花了多少钱啊?");
int input = int.Parse((Console.ReadLine()));
string Display;
if (input < 5)
{
Display = "你可以走了!";
}
else if (input > 5 && input < 20)
{
Display = "奖励你一杯咖啡!";
}
else if (input > 20 && input < 30)
{
Display = "送你五块钱";
}
else if (input > 30 && input < 50)
{
Display = "你是疯子哇!";
}
else
{
Display = "早点回去睡觉吧!";
}
Console.WriteLine(Display + "\n再见!不送。");
Console.ReadKey();
}
}
}
本文提供了一个使用C#在Visual Studio中创建控制台应用程序的例子。该程序通过读取用户输入来判断消费金额并给予不同反馈。示例覆盖了基本的条件判断、字符串操作和控制台交互。
1217

被折叠的 条评论
为什么被折叠?



