VS复习 -- if···else和if···else嵌套语句
2024-10-10 01:37:09
注意:理清逻辑,画出逻辑分支图,理清思路
1.if语句
2.if...else语句
3.if..else if...else
static void Main(string[] args)
{
Console.WriteLine("输入分数:"); string fs = Console.ReadLine();
int score = Convert.ToInt32(fs); #region 判断分数
if (score >= && score < )
{
Console.WriteLine("不及格,补考");
}
else if (score >= && score < )
{
Console.WriteLine("恭喜及格");
}
else if (score >= && score <= )
{
Console.WriteLine("恭喜优秀");
}
else
{
Console.WriteLine("输入有误");
}
#endregion Console.WriteLine("结束");
}
3.输入分数,如果小于60,再判断加分项,然后输出是否及格
static void Main(string[] args)
{
Console.WriteLine("输入分数:"); string fs = Console.ReadLine();
int score = Convert.ToInt32(fs); if (score < )
{
Console.WriteLine("是否认真做作业?(是,否)"); string zuoye = Console.ReadLine(); #region ======加分=======
if (zuoye == "是")
{
score = score + ; if (score < )
{
Console.WriteLine("不及格");
}
else
{
Console.WriteLine("凑合及格");
}
}
else
{
Console.WriteLine("不及格了");
}
#endregion
}
else
{ } Console.WriteLine("结束");
}
最新文章
- Tomcat下conf下server.xml的文件配置信息
- IOS 问题集锦
- SQL Server 2014如何提升非在线的在线操作
- little skill---ping
- 一、spring——helloWorld
- CDH hive的安装
- Wordpress Jigoshop插件路径泄露漏洞
- Android中为窗口定义主题
- ftk学习记(waitbox篇)
- HDU1686:Oulipo
- typedef和define的详细区别
- SpringMVC源码情操陶冶-View视图渲染
- Win10系统下的Tomcat7.0配置
- Spring_Spring与AOP
- HTML5 拖放(Drag 和 Drop)详解与实例(转)
- .NET下对Web.config与App.Config的增删改操作的代码
- 【C++】满二叉树问题
- java学习之路--继承(多态的动态绑定)
- STM32的型号的命名规则
- JAVA Swing使用JFreeChart实现折线图绘制