好吧,我已经在这几个小时了....
//after a character is entered, library routines are used to uppercase the
letters. loops the program until "1" is entered
char letter;
while (letter != '1')
{
cout << "Enter a letter: ";
cin.get(letter);
cout << char(toupper(letter)) << '\n';
}
一切正常,但它会“输入一个字母:”两次......
这是一个示例输出
Enter a letter: h
H
Enter a letter:
Enter a letter: k
K
Enter a letter:
Enter a letter: a
A
我希望它看起来像这样
Enter a letter: h
H
Enter a letter: k
K
Enter a letter: a
A
你能帮忙解释一下为什么会这样吗......