You are on page 1of 3

INFORMATION TECHNOLOGY EDUCATION DEPARTMENT

ITE101L
(INTRODUCTION TO PROGRAMMING)

EXERCISE

3
INTRODUCTION TO C++

<STUDENT NAME>
<SECTION>
<DATE>

I. OBJECTIVES
At the end of this exercise, students must be able to:

Know the structure of C++ program


Define programming terminologies
Familiar with the use of Microsoft Visual Studio 2010 to develop C++ programs
Know the console output and escape sequences
Use the console input
Enumerate and define the data types used in developing C++ programs
Enumerate Operators & Expression and know they are used
Know the order of precedence and associatively.
Declare a variable

II. BACKGROUND INFORMATION


Structure of a C++ program
// my first program in C++
#include <iostream>
using namespace std;
int main ()
{ cout << "Hello World!";
return 0;
}
// my first program in C++
This is a comment line. All lines beginning with two slash signs (//) are considered
comments and do not have any effect on the behavior of the program.
#include <iostream>
Lines beginning with a hash sign (#) are directives for the preprocessor. This specific
file (iostream) includes the declarations of the basic standard input-output library in
C++.
cout << "Hello World!";
This line is a C++ statement. A statement is a simple or compound expression that can
actually produce some effect.
Each statement must be terminated by a semicolon (;)
return 0;
The return statement causes the main function to finish, return may be followed by a
return code 0;

III. LABORATORY ACTIVITY

ACTIVITY 2.1: Console Output and Escape Sequences

1. Write a program that will display your weekly class schedule in a listed view.

Consider the following output:


Monday
7:00-8:50 ITES 103 N05 T805
2. Given the table below, declare the following variables with the corresponding
data types and initialization values. Output the variable names together with
the values.

Variable name
Data Type Initial value
Number
integer
10
Letter
character a
Result
boolean true
Float
float
3.14
3. Write a program that will display your autobiography. Your autobiography
should consist of not less than 200 words.

You might also like