小编Jos*_*eza的帖子

C++ int switch 语句

我在过去的一个半小时里一直在研究整数的开关,我知道如何用 char 进行开关,但这对我来说似乎很难。任何建议将不胜感激。我遇到的问题是我不能接受成绩该开关当前执行的操作超过 100

\n\n
    int testScore;                     \n    cout <<"Enter your test score and I will tell you \\n";\n    cout <<"the letter grade you earned ";\n    cin >> testScore;\n\n    switch(testScore/10)\n{ \n    case 10:\n    case 9:\n        cout <<"Your grade is A.\\n";\n    break;\n    case 8: \n        cout <<"Your grade is B.\\n";\n    break;\n    case 7: \n        cout <<"Your grade is C.\\n";\n        break;\n    case 6: \n            cout << "Your grade is D.\\n";\n        break;\n    case 5: \n            cout << "Your grade is F.\\n";\n        break;\n\n    default:\n …
Run Code Online (Sandbox Code Playgroud)

c++ switch-statement

5
推荐指数
1
解决办法
4万
查看次数

标签 统计

c++ ×1

switch-statement ×1