zoukankan      html  css  js  c++  java
  • VS 复习,if...else if..else 和if..else的嵌套学习

    内容;if..else 输入:准确找到要计算的值,通过“if..else”进行分类,一般在分类时是最容易分不清,注意要分清楚问的重点;例分数两种情况1)及格(在及格的前提下优秀用if嵌套if),2)补考,然后就是结束。
    输出:记住你输入的是字符,并非电脑认可的数字,所以再输入时要使用转义字符:例 以int,为例int.Parse()或Convert.Toint。还有doubie,fioat,等;
    1.

     


     static void Main666(string[] args)
            {
                Console.WriteLine("输入分数:");

    string fs = Console.ReadLine(); int score = Convert.ToInt32(fs); if (score < 60) { Console.WriteLine("是否认真做作业?(是,否)"); string zuoye = Console.ReadLine(); #region ======加分======= if (zuoye == "") { score = score + 5; if (score < 60) { Console.WriteLine("不及格"); } else { Console.WriteLine("凑合及格"); } } else { Console.WriteLine("不及格了"); } #endregion } else { } Console.WriteLine("结束"); } static void Main222(string[] args) { Console.WriteLine("输入分数:"); string fs = Console.ReadLine(); int score = Convert.ToInt32(fs); #region 判断分数 if (score >= 0 && score < 60) { Console.WriteLine("不及格,补考"); } else if (score >= 60 && score < 80) { Console.WriteLine("恭喜及格"); } else if (score >= 80 && score <= 100) { Console.WriteLine("恭喜优秀"); } else { Console.WriteLine("输入有误"); } #endregion Console.WriteLine("结束"); } static void Main111(string[] args) { int a = 10; int b = 5; int c = (a++) + b; int d = (++a) + b; Console.WriteLine(a); Console.WriteLine(c); Console.WriteLine(d); } static void abc(string[] args) { Console.WriteLine("输入分数:"); string fs = Console.ReadLine(); int score = Convert.ToInt32(fs); if (score < 60) { Console.WriteLine("不及格,需要补考"); } Console.WriteLine("结束"); }
  • 相关阅读:
    Linux makefile 教程 很具体,且易懂
    Java串口通信具体解释
    今年股票注定有一波行情(重申6月10号的观点)
    hotmail邮箱pop3server设置方法
    html的下拉框的几个基本使用方法
    第1次实验——NPC问题(回溯算法、聚类分析)
    【甘道夫】Hive 0.13.1 on Hadoop2.2.0 + Oracle10g部署详细解释
    C该程序生成一个唯一的序列号
    高速分拣(1)的基本算法
    Eclipse项目崩溃,使用MyEclipse解决
  • 原文地址:https://www.cnblogs.com/koker/p/5399547.html
Copyright © 2011-2022 走看看