来自 Turbo C++ 的 C++ INTRO14.CPP 示例
#include <iostream.h>
int main ()
{
int your_number;
cout << "Enter a whole number: ";
cin >> your_number;
if (your_number % 2 == 0)
cout << "\nYour number is even\n";
if (your_number % 2 != )
{
cout << "Your number is odd.\n";
}
cout << "That's all!\n";
}
我只收到消息“输入一个整数”。当我输入奇数或偶数时,程序似乎终止了。
只有在我返回 DOS shell 后,我才会收到消息“您的号码是偶数”(或奇数)。
当我从 IDE 中点击 RUN 时,为什么我只能得到部分输出?