C++ programming tutorial / PDF
C++ programming tutorial / PDF
Sample of the PDF document
C++ Program
A sequence of structured statements written by programmer using C++ language to solve a problem.
Using Visual
C++ to write your program
1- Start
à
Programs à
Microsoft Visual Studio 6 à Microsoft Visual C++ 6
2- File à New à Files à C++
Source file à oK
3- Write
your program using C++ statements
4-
Compilation: Ctrl + F7 to see if the program has error's
5-
Execution: to display the program’s result
Remarks:
- iostream.h: C++ library that contains all input/output statements and other constrols.
- main(): the main function of the program which represents the program’s life time.
- a, b, and s are three variables of type integer. Their values can be any integer and can be changed.
- cin>>: C++ statement to take value(s) from the user.
- cout<<: C++ statements to display value(s) to the output screen.
- " ": must be around any character constants.
- \n or endl: to start new line at output screen.
Variables
Variables:
-
Variable is one memory location.
-The name of the location is the variable name.
-The location content is the value of the variable
- You can change the content of the variable at any
time in the statements of the algorithm.
e.g.
Name of the location Inside Memory location
employee_name "Ali Ahmed"
age 35
hourly_rate 3.25
Data Types :
Predefined Data Types:
•int : values (e.g. 5
, -321 , 12)
operations (e.g. + , - , * , / , %
, >, <, = =, !=, > =, <= )
•float (double) :
values (e.g. 3.2 , 1.23E+5 , 0.34E-2)
operations (e.g. +, -, *, /, , >, <, = =,
!=, > =, <= )
•bool : values (true
, false)
operations (e.g. AND, OR, NOT)
•char : values (e.g. ‘A’ , ‘t’ , ‘(‘ , ‘5’ , ‘;’
)
operations (e.g. <, > ,
≤, etc.)..........
C++ programming tutorial / PDF
0 commentaires: