小学生c ++プログラミング情報
リンク:https
://pan.baidu.com/s/1XlA5AcjDXz5YWOFT32gSmw抽出コード:9iz9
#include <iostream> using namespace std; int main() { int n; char score; cout << "Please enter score:"; cin >> n; switch(n / 10)// n、10は整数、 n / 10も整数です { ケース10: ケース9:スコア= 'A';ブレーク; ケース8: ケース7:スコア= 'B';ブレーク; ケース6:スコア= 'C';ブレーク; ケース5: ケース4: ケース3: ケース2: ケース1: ケース0:スコア= 'D'; break; デフォルト:スコア= ''; break; //スコアにスペースが割り当てられ ます } cout <<スコア; return 0; }