lesson 2 easy cpp
[[lesson_2_easy_cpp]] last edit on Aug 6, 2005 3:59 PM by rescued_by_c

[user02@FC4 Lesson02]$ cat -n easy.cpp
   1  #include <iostream>
   2  using namespace std;
   3
   4  int main()
   5  {
   6     cout << "Programming in C++ is easy!\n";
   7
   8     return 0;
   9  }
[user02@FC4 Lesson02]$ g++ -o easy easy.cpp
[user02@FC4 Lesson02]$ ./easy
Programming in C++ is easy!



[user02@FC4 Lesson02]$ cat -n easy2.cpp
   1  #include <iostream>
   2  using namespace std;
   3
   4  int main()
   5  {
   6     cout << "Programming in C++ is easy!";
   7     cout << endl << "And pretty cool!\n";
   8
   9     return 0;
  10  }
[user02@FC4 Lesson02]$ g++ -o easy2 easy2.cpp
[user02@FC4 Lesson02]$ ./easy2
Programming in C++ is easy!
And pretty cool!



using endl rather than \n.

   1  #include <iostream>
   2  using namespace std;
   3
   4  int main()
   5  {
   6     cout << "Programming in C++ is easy!" << endl;
   7
   8     return 0;
   9  }


   1  #include <iostream>
   2  using namespace std;
   3
   4  int main()
   5  {
   6     cout << "Programming in C++ is easy!" << endl;
   7     cout << "And pretty cool!" << endl;
   8
   9     return 0;
  10  }