[[lesson_7_cin_long.cpp]] Rescued by C++ Reloaded

Route:


[user02@FC4 Lesson07]$ cat -n cin_long.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 long value; 7 8 cout << "Type a large number and press Enter: "; 9 cin >> value; 10 cout << "The number you typed was " << value << endl; 11 12 return 0; 13 }
[user02@FC4 Lesson07]$ g++ -o cin_long cin_long.cpp
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: 4000000
The number you typed was 4000000
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: 500000000
The number you typed was 500000000
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: 50000000000000
The number you typed was 11246752
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: -9999999999999
The number you typed was 11246752
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: abc
The number you typed was 11246752
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: 34.56
The number you typed was 34
[user02@FC4 Lesson07]$ ./cin_long
Type a large number and press Enter: .45
The number you typed was 11246752
[user02@FC4 Lesson07]$
lesson_7_cin_long.cpp, Rev. 1, Last changed on 2005-08-10 03:15, 327 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.227 seconds || || PAGERANK TOOLS