lesson 6 mattover cpp
[[lesson_6_mattover_cpp]] last edit on
Aug 9, 2005
2:11 AM
by rescued_by_c
[user02@FC4 Lesson06]$ cat -n mathover.cpp
[user02@FC4 Lesson06]$ ./mathover
200 * 300 = 60000
[user02@FC4 Lesson06]$ cat -n mathover2.cpp
[user02@FC4 Lesson06]$ ./mathover2
200 * 300 = -5536
[user02@FC4 Lesson06]$ cat -n mathover3.cpp
[user02@FC4 Lesson06]$ ./mathover3
200000 * 300000 = -129542144
[user02@FC4 Lesson06]$
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]$