C++入门经典-例3.10-根据输入的字符输出字符串

1:代码如下:

// 3.10.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
    cout<<"输入一个A-D范围内的大写字母作为成绩评价"<<endl;
    char iInput;
    cin >> iInput;
    switch (iInput)
    {
    case 'A':
    cout << "very good" << endl;
    break;
    case 'B':
    cout << "good" << endl;
    break;
    case 'C':
    cout << "normal" << endl;
    break;
    case 'D':
    cout << "failure" << endl;
    break;
    default:
        cout << "input error" << endl;
    }
}
View Code

运行结果:

原文地址:https://www.cnblogs.com/lovemi93/p/7515006.html