小编Dar*_*art的帖子

switch语句c ++帮助

#include <iostream>

using namespace std;

int main()
{
    int score;
char grade;
cout << "Enter your score:" << endl;
cin >> score;
if (score >= 90)
    grade = 'a';
if (score >= 80)
    grade = 'b';
if (score >= 70)
    grade = 'c';
if (score >= 60)
    grade = 'd';
else 
    grade = 'f';
cout << grade << endl;
switch (grade) {
    case 'a':
        cout << "Good job" << endl;
        break;
    case 'c':
        cout << "Fair job" << endl;
        break; …
Run Code Online (Sandbox Code Playgroud)

c++ conditional switch-statement

4
推荐指数
2
解决办法
7851
查看次数

标签 统计

c++ ×1

conditional ×1

switch-statement ×1