C#逻辑判断输入值后返回提示信息。
2011-09-13 15:34
351 查看
// VS中新建控制台程序,用以下源码运行后在cmd中提示及返回值。CSC提示找不到!
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();
}
}
}
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();
}
}
}
相关文章推荐
- 在主函数中提示用户输入用户名和密码。另写一方法来判断用户输入是否正确。该方法分别返回一个bool类型的登录结果和和一个string类型的登录信息。如登录成功,返回true及“登录成功”,若登录失败则返回false及“用户名错误”或“密码错误”(使用out参数)
- C#开发之生成XmlDocument用来返回错误提示信息
- python字典中没有输入的键key 返回一定的错误信息或者提示状态
- Spring MVC控制层判断登录 ,登录失败则返回提示信息
- 题目:JavaScript编程题 页面上输入一个年份(需验证),判断是否是闰年(能被4整除却不能被100整除的年份;能被400整除的是闰年),需在页面上显示提示信息
- 题目:JavaScript编程题 页面上输入一个年份(需验证),判断是否是闰年(能被4整除却不能被100整除的年份;能被400整除的是闰年),需在页面上显示提示信息
- 判断输入的信息是否为空,如果为空,提示信息
- Js判断密码强度并显示提示信息
- linux 有的时候输入命令返回信息太多,二屏幕显示有限,前面的内容看不到
- jQuery实现TEXT文本框输入时的提示信息(谷歌百度淘宝搜索框提示实现)
- java网络编程二:服务器处理多个用户请求的解决方案(返回多个用户输入的信息)
- C# 通过分析netstat -an所得信息 查看本机所监听的端口 及判断某端口是否可用
- 偷懒把本来要判断输入值的textbox 输出提示值,结果点两次程序异常
- VS2010 学习笔记 WF4 (7) 学习If/Else逻辑节点,根据输入参数的长度来返回不同的问候语
- comboBox输入自动提示 自动关联(仿ie地址栏)C#
- 服务器向客户端返回的常见状态码和提示信息
- c# 输入字符为汉字的判断方法
- 提示用户输入信息,并将用户输入的写入一个文件,当用户输入的信息 是quit的时候,打印输出用户输入的总长度
- 完成系统登录程序,从命令行输入用户名和密码,如果没有输入用户名和密码,则提示输入用户名和密码;如果输入了用户名但是没有输入密码,则提示用户输入密码,然后判断用户名是否是mldn,密码是否是hello,
- C#datetime判断日期输入是否正确