Ict 1ST QTR
Ict 1ST QTR
1. Health Risks
2. Violation of Privacy
3. Public Safety
4. Impact on Labor Force
5. Impact on the Environment
Input
Data items enter computer
Processing
By central processing unit (CPU)
Output
preprocessor directive
#include<iostream>
Message to the C++ preprocessor. Lines beginning with # are preprocessor directives.
#include <iostream> tells the preprocessor to include the contents of the file <iostream>,
which includes input/output operations (such as printing to the screen)-
using namespace std; A namespace is used as additional information to differentiate similar functions, classes,
variables etc. with the same name available in different libraries. Using namespace, you
can define the context in which names are defined. (std = standard)
int main() C++ programs contain one or more functions, one of which must be main Parenthesis
are used to indicate a function. int means that main "returns" an integer value.
{
cout << "Hello world!"; Prints the string of characters contained between the quotation marks. The entire line,
including cout, the << operator, the string "Hello World" and the semicolon (;), is called a
statement. All statements must end with a semicolon.
return 0; Return is a way to exit a function from a function. return 0 (zero), in this case, means that
} the program terminated normally.
Escape Sequences:
Variables are used to store information to be later
Escape Sequence Explanation
manipulated in a computer program. Variables also
\n Creates a new line or offer a way of labeling data with a descriptive name;
line break. the programs can be appreciated more clearly by the
\t Inserts a horizontal tab reader. Variables are containers that hold information.
or spacing. The purpose is to label and store data in memory. This
\r Carriage return: Moves data can then be used throughout your program.
the cursor to the
beginning of the line. Fundamental data types
\a Alert. Sound the system
bell. The values of variables are stored somewhere in an
\ Represents a backslash unspecified location in the computer memory as zeros
character. and ones. Our program does not need to know the
" Represents a double exact location where a variable is stored; it can simply
quote character. refer to it by its name. What the program needs to be
aware of is the kind of data stored in the variable. It's
not the same to store a simple integer as it is to store a
letter or a large floating-point number; even though
they are all represented using zeros and ones, they
are not interpreted in the same way, and in many
cases, they don't occupy the same amount of memory.
Note:
== equal to
!= not equal to
CONDITIONAL STATEMENTS: