EECE 230 Useful File Chapter 2 Code Examples, Spring 2008

American University of Beirut · Introduction to Programming · 3 pages

All EECE 230 files
EECE 230 Useful File Chapter 2 Code Examples, Spring 2008, page 1

Stuck on a question? A tutor can walk you through it.

EECE 230 Useful File Chapter 2 Code Examples, Spring 2008, page 2 EECE 230 Useful File Chapter 2 Code Examples, Spring 2008, page 3

More EECE 230 files

Show the text of this file
#include <iostream> using namespace std; int main() { cout << "Welcome to C++ Programming." << endl ; return 0; } #include <iostream> using namespace std; int main() { int a, b; a = 65; //Line 1 b = 78; //Line 2 cout << 29 / 4 << endl; //Line 3 cout << 3.0 / 2 << endl; //Line 4 cout << "Hello there.\n"; //Line 5 cout << 7 << endl; //Line 6 cout << 3 + 5 << endl; //Line 7 cout << "3 + 5"; //Line 8 cout << endl; //Line 9 cout << 2 + 3 * 6 << endl; //Line 10 cout << "a" << endl; //Line 11 cout << a << endl; //Line 12 cout << b << endl; //Line 13 return 0; } #include <iostream> //Line 1 using namespace std; //Line 2 const int number = 12; //Line 3 int main() //Line 4 { //Line 5 int firstNum; //Line 6 int secondNum; //Line 7 firstNum = 18; //Line 8 cout << "Line 9: firstNum = " << firstNum << endl; //Line 9 cout << "Line 10: Enter an \" integer: "; //Line 10 cin >> secondNum; //Line 11 cout << endl; //Line 12 cout << "Line 13: secondNum = " << secondNum << endl; //Line 13 firstNum = firstNum + number + 2 * secondNum; //Line 14 cout << "Line 15: The new value of " << "firstNum = " << firstNum << endl; //Line 15 return 0; //Line 16 }