为什么我不能用“\x”初始化字符串
string s = "\x"
如果我以后可以写的话会很有用:
int grade = 0;
while (cin >> grade)
if (grade < 60)
cout << "Your grade letter is F!";
else {
x = 50 - grade/10;
s = s + static_cast<string>(x);
cout << "Your grade letter is " << s << endl;
}
我更喜欢答案,它使用转义序列计算来设置等级字母。