1. Comp Prog Recap
1. Comp Prog Recap
cpp
Computer
2
3
Programming Recap
4
5 {
6
7 <Presented by: Grethel Einstein Bernardino>
8
9
10 }
11
12
13
14
1 Table Of ‘Contents’ {
2
3
4 01 C++ Overview 06 Keywords
5
6 02 C++ Application 07 Basic Operators
7
8 03 Basic C++ syntax
08 Basic Input/Output
9 Statement
10 04 Data Types
09 Using a code/text
11
12
05 Variables editor or an IDE
13 10 Codeblocks Installation
14 }
C++ Programming Language
main.cpp sample.cpp
01 {
1
2
3
4
[C++ Overview]
5
6
7
}
8
9
10
11
12
13
14
1 What is C++? {
2 - one of the world's most popular programming languages
- a cross-platform/general language that can be used to create high-
3
performance applications.
4 - can be found in today's operating systems, Graphical User
5 Interfaces, and embedded systems (e.g: Operating systems, Web
6 browsers, Machine learning, Databases, IoT devices, Financial
7 tools, Flight software, Medical technology, Movie production,
Flight software).
8 - developed by Bjarne Stroustrup, as an extension to the C language
9 (a general-purpose, procedural, imperative computer programming
10 language developed in 1972 by Dennis M. Ritchie at the Bell
11 Telephone Laboratories to develop the UNIX operating system).
- an object-oriented programming language which gives a clear
12 structure to programs and allows code to be reused thru the use of
13 classes and objects, lowering development costs.
14 - gives programmers a high level of control over system resources and
memory
02 {
1
2
3
4
5
6
7
[First C++
8
9
10
Application]
11
}
12
13
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
03 {
1
2
3
4
[C++ Syntax]
5
6
7
8 < File extension: .cpp and it is case-sensitive>
}
9
10
11
12
13
14
04 {
1
2
3
4
[Data Types]
5
6
7
8 < An attribute associated with a piece of data
9 that tells a computer system how to interpret its
value >
10
11
}
12
13
14
1 ‘Data Types’{
2
3 char string
<Consist of multiple or
4 < Single text character. sequence of characters.
5 Indicated with single Indicated with double
6 quotes ‘’> quotes “”>
7
int double
8
< Handles numbers
9 < Integer consist of
with decimal points
10 whole numbers >
or floating points>
11
12 bool float
13 < Represents 2 < similar to double but
14 } values: true (1) or
false (0)>
less precision and
requires less memory>
You may also use the auto keyword
C++ Programming Language which allows you to set the type of
the variable based on its value.
main.cpp sample.cpp
05 {
1
2
3
4
[Variables]
5
6
7
8 < A named location in memory. It is used to store
9 data or information >
10
11
}
12
13
14
1
Declaration
2 declaring/defining of what type is a variable (to know what
3 operations can be done with it) and its name.
4
5 Syntax: dataType variableName;
Shortcuts: dataType variableName1, variableName2, variableName3;
6 dataType variableName1 = value, variableName2 = value;
7
8 Initialization
9 specifying an initial value for the variable using (=) the
assignment operator.
10
11 Syntax: variableName = value;
12
13 Note: A variable can change its value during the program by
being assigned to a new value.
14
06 {
1
2
3
4
[Keywords]
5
6
7
< also known as reserved words. Have special meaning
8
to the C++ compiler and are always written or typed
9 in lower cases. Keywords are words that the language
10 uses for a special purpose, such as cout, cin, void,
11 int, public, etc. It can’t be used for a variable
name or function name. >
}
12
13
14
07 {
1
2
3
[Basic Operators]
4
5
6
7 < Operators are used to perform operations on
variables and values. And divided into 4
8
groups/types: Arithmetic, Assignment, Comparison
9 and Logical Operators>
10
11
}
12
13
14
1 Arithmetic Operators {
2
< Used to perform common mathematical operations. >
3
4
5
6
7
8
9
10
11
12
13
14 }
C++ Programming Language
main.cpp sample.cpp
1 Comparison Operators {
2
< Used to compare two values. >
3
4
5
6
7
8
9
10
11
12
13
14 }
C++ Programming Language
main.cpp sample.cpp
1 Assignment Operators {
2
< Used to assign values to variables. >
3
4
5
6
7
8
9
10
11
12
13
14 }
C++ Programming Language
main.cpp sample.cpp
1 Logical Operators {
2
< Used to determine the logic between variables or values. >
3
4
5
6
7
8
9
10
11
12
13
14 }
C++ Programming Language
main.cpp sample.cpp
08 {
1
2
3
[Basic Input/
4
5
6
7
8 Output Statement]
9 < C++ comes with libraries that provide us with many
10 ways for performing input and output. In C++ input
and output are performed in the form of a sequence
11 of bytes or more commonly known as streams. >
}
12
13
14
1
2 Variable declaration, for the
compiler to know the expected type
3 of data to be inputted Save inputted data on the variable.
4
5
6
7
8
9
10 Print the inputted number stored on the
11 variable or process/manipulate it.
cout means console out
12
13
14
09 {
1
2
3
[Using a code/
4
5
6
7
8 text editor or
an IDE]
9
10
}
11
12
13
14
1 Text Editor
2
3 E.g: Atom, Sublime, Visual Studio Code
4 < A tool that is designed to edit text, designed to
5 work with whatever language or framework you
6 choose. Simpler and lightweight than IDEs. >
7
8 IDE (Integrated Development
9 Environment)
10
11 E.g: XCode, Eclipse, Visual Studio, CodeBlocks
12 < a set of tools that all work together: text editor,
13 compiler, build or make integration, debugging. IDEs are
tied specifically to a language or framework or tightly
14 collected set of languages or frameworks>
1 Debugging on Codeblocks
2
Check the logs & others tab to debug error encountered in red.
3
4
5
6
7
8
9
Make sure Logs are
10 enabled/checked to view
11 the logs.
12
13
14
10 {
1
2
3
4
[Codeblocks
5
6
7
8
9
10
Installation]
}
11
12
13
14
1 Download Links: {
2
https://sourceforge.net/projects/codeblocks/
3 files/Binaries/20.03/Windows/codeblocks-
4 CodeBlocks 20.03mingw-setup.exe/download
5
6 Visual https://visualstudio.microsoft.com/
7 Studio vs/community/
8 CodeBlocks
9 Visual Studio
10
11
12
13
14 }
C++ Programming Language
main.cpp sample.cpp
1 Codeblocks Installation {
2 1. Download from provided link or from
3 https://www.codeblocks.org/downloads/binaries/
4 Select codeblocks-20.03mingw-setup.exe
5 2. Run the installer, just press Next after reading
each screen.
6
7 3. 4.
8
9
10
11
12
13
14 }
C++ Programming Language
main.cpp sample.cpp
1 5. 6.
2
3
4
5
6
7
8
9
7. 8. Select the detected
10
compiler and proceed.
11
12 Finish
13
14
1 Thanks; {
2
3
‘Do you have any questions?’
4
5
[email protected]
6
7
8
9
CREDITS: This presentation template was
10 created by Slidesgo, including icons by
Slidesgo
Freepik
Freepik
12
< Please keep this slide for attribution >
13
14 }
C++ Programming Language