This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / C++ bug? run the following program.
Then input 100. ok. but input 0x100. the output is meaningless. How to make the program adaptive?using namespace std;
int main ()
{
unsigned int content;
cin >> content;
cout << content;
return 1;
}
-iwantcar(流浪的EnjoyStudying);
2006-6-22
{114}
(#3041275@0)
-
Are you kidding me? I haven't touch C++ for nine years but still know you can do "cin >> hex >> i;"
-canadiantire(轮胎-cui bono?);
2006-6-22
(#3041301@0)
-
How to make the program adaptive? It is a little bit dangerous to use << because the user might input something unexpected.
-iwantcar(流浪的EnjoyStudying);
2006-6-22
(#3041480@0)
-
Maybe, write your own input stream or operator
-canadiantire(轮胎-cui bono?);
2006-6-22
(#3041511@0)
-
In fact, that is what I did before.
-iwantcar(流浪的EnjoyStudying);
2006-6-23
(#3043639@0)