lesson 7 twonbrs cpp
[[lesson_7_twonbrs_cpp]] last edit on
Aug 18, 2005
6:18 AM
by rescued_by_c
[user02@FC4 Lesson07]$ cat -n twonbrs.cpp
[user02@FC4 Lesson07]$ ./twonbrs
Type two numbers and press Enter: 37 478
The numbers typed were 37 and 478
[user02@FC4 Lesson07]$ ./twonbrs
Type two numbers and press Enter: abc def
The numbers typed were 12480500 and 0
1 #include <iostream>
2 using namespace std;
3
4 int main()
5 {
6 int first, second; // Numbers typed at the keyboard
7 8 cout << "Type two numbers and press Enter: "; 9 cin >> first >> second; 10 cout << "The numbers typed were " << first << " and " << second << endl; 11 12 return 0; 13 }[user02@FC4 Lesson07]$ g++ -o twonbrs twonbrs.cpp
[user02@FC4 Lesson07]$ ./twonbrs
Type two numbers and press Enter: 37 478
The numbers typed were 37 and 478
[user02@FC4 Lesson07]$ ./twonbrs
Type two numbers and press Enter: abc def
The numbers typed were 12480500 and 0