美好的一天,
我有一个我编写并正在测试的简单程序。 它输出输入的两个整数类型变量中较小的一个:
#include "library/std_lib_facilities.h"
int main()
{ //PPP by Bjarne Stroustup Chapter 4 drill
int first, second = 0;
cout << "Please type in two numbers seperated by space: ";
while(cin >> first >> second)
if(first > second)
cout << "The smaller value is: " << second << "\nPlease try again: ";
else
cout << "The smaller value is: " << first << "\nPlease try again: ";
return 0;
}
当输入为中小型值时,它工作正常,但循环立即中断一个大值作为变量之一输入,如(5678885645684534342646262326245234523)。
我还是新人,所以这可能是我尚未学习或做错的事情。
如果可以解释的话,将不胜感激。