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

Route:


[user02@FC4 Lesson06]$ cat -n mathover.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int result; 7 8 result = 200 * 300; 9 10 cout << "200 * 300 = " << result << endl; 11 12 return 0; 13 }
[user02@FC4 Lesson06]$ g++ -o mathover mathover.cpp
[user02@FC4 Lesson06]$ ./mathover
200 * 300 = 60000



[user02@FC4 Lesson06]$ cat -n mathover2.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 short result; 7 8 result = 200 * 300; 9 10 cout << "200 * 300 = " << result << endl; 11 12 return 0; 13 }
[user02@FC4 Lesson06]$ g++ -o mathover2 mathover2.cpp
[user02@FC4 Lesson06]$ ./mathover2
200 * 300 = -5536



[user02@FC4 Lesson06]$ cat -n mathover3.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int result; 7 8 result = 200000 * 300000; 9 10 cout << "200000 * 300000 = " << result << endl; 11 12 return 0; 13 }
[user02@FC4 Lesson06]$ g++ -o mathover3 mathover3.cpp
[user02@FC4 Lesson06]$ ./mathover3
200000 * 300000 = -129542144
[user02@FC4 Lesson06]$
lesson_6_mattover.cpp, Rev. 1, Last changed on 2005-08-09 02:11, 327 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.238 seconds || || PAGERANK TOOLS