zoukankan      html  css  js  c++  java
  • if语句的选择结构

    #include<iostream>
    using namespace std;
    int main()
    {
        int grad;
        cout<<"请输入你要查询的成绩:"<<endl;
        cin>>grad;
        if(grad>100)
            cout<<"您输入的数据错误";
        else if(grad>=90&&grad<=100)
            cout<<"A";
        else if(grad>=80&&grad<90)
            cout<<"B";
        else if(grad>=70&&grad<80)
            cout<<"C";
        else if(grad>=60&&grad<70)
            cout<<"D";
        else
            cout<<"E";
    }

    ————————————————————————————————————

    嵌套的语句——查询成绩

    #include<iostream>
    using namespace std;
    int main()
    {
        int grad;
        cout<<"请输入你要查询的成绩:"<<endl;
        cin>>grad;
        if(grad>100||grad<0)
            cout<<"您输入的数据错误";

        else if(grad<60)
            cout<<"E";
        else
        {
            if(grad<70)
                cout<<"D";
            else
            {
                if(grad<80)
                    cout<<"C";
                else
                {
                    if(grad<90)
                        cout<<"B";
                    else
                        cout<<"A";
                }
            }
        }

    }

  • 相关阅读:
    hibernate注解note
    hibernate的批量删除
    hibernate实现多表联合查询
    hibernate联合主键注解方式
    jsp之radio取值与赋值
    @Transient注解的使用
    工程师如何在工作中提升自己?(公众号)
    HTML中让表单input等文本框为只读不可编辑的方法
    ajax, jQuery, jQueryeasyUI
    关于easyui的问答(来自百度问答)
  • 原文地址:https://www.cnblogs.com/ywj2013/p/3137299.html
Copyright © 2011-2022 走看看