0% found this document useful (0 votes)
20 views8 pages

Understanding of C++

The document provides an overview of C++ programming including its history, tools used for C++ development like compilers and linkers, basic C++ concepts like variables, data types, operators, functions, objects, and control structures. It also defines some key C++ terms and vocabulary.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views8 pages

Understanding of C++

The document provides an overview of C++ programming including its history, tools used for C++ development like compilers and linkers, basic C++ concepts like variables, data types, operators, functions, objects, and control structures. It also defines some key C++ terms and vocabulary.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

UNDERSTANDING OF

C++ PROGRAMMING
BY: ELJO JALIEL CARIÑO
VIRTUAL TUTOR EDUCATION
GRADUATE OF BSIT 2017
INTRODUCTION OF C++
C++, as we all know is an extension to C language and was
developed by Bjarne stroustrup at bell labs. C++ is an
intermediate level language, as it comprises a confirmation
of both high level and low level language features. C++ is a
statically typed, free form, multiparadigm, compiled
general-purpose language.

C++ is an Object Oriented Programming language but is


not purely Object Oriented. Its features
like Friend and Virtual, violate some of the very important
OOPS features, rendering this language unworthy of being
called completely Object Oriented. It’s a middle level
language.

C++ will help you instill good programming habits (i.e. clear
and consistent coding style, comment the code as you
write it, and limit the visibility of class internals to the outside
world), and because there’s hardly any abstraction, you’re
required to define just about every attribute to make your
code work.
OVERVIEW OF C++ TOOLS
In order to properly make C++ programs, you’ll need to be
familiar with a few tools and softwares: a text editor, a C++
compiler, a linker, and libraries.

TEXT EDITOR
In order to write a C++ program, you need a text editor.
Think of this like a blank Microsoft Word Document; it is
where you will actually write your code. Any text editor will
do, and there are even some that come built into your
computer, but we recommend using a text editor designed
for coding. There are many options out there, but some of
the most common text editors for C++ developers are:
 Notepad++: open-access, lightweight, simple
 Atom: free, supports many languages, limited plugins
 Sublime Text: $80, unique features, simple layout
 Bluefish: lightweight, fast, multi-platform, supports many
languages

COMPILERS
A compiler goes through your source code to accomplish
two important tasks: first, it checks that your code follows
the C++ language rules; second, it translates your code into
an object file. Some well-known compilers are GCC, Clang,
and the Visual Studio C++ compiler. We don’t recommend
Turbo C++, since it’s a bit out of date.

LINKER
Once the compiler does its magic, the object file is sent to a
linker program which completes three tasks: first, it combines
all your object files into a single program; second, it links
library files to your program; and third, it exposes any cross-
file naming or reference issues.
LIBRARIES
A library is essentially a prepackaged bundle of code that
can be reused. The C++ library is called the C++ Standard
Library, and this is linked to almost every C++ program. You
can also add other libraries to your program if you have
needs not met by the C++ Standard Library.

TERMS AND VOCABULARY


KEYWORDS:
Keywords are predetermined names that can be used to
identify things in your code. Keywords are identifiers for
particular objects, variables, or actions. You can also make
your own keywords. Here are a few examples of keywords:

 Goto
 Float
 Public
 Class(1)
 Int
VARIABLES
Variables are like containers that store values. To declare a
variable, you must give it a value and a type using the
correct keyword. All variables in C++ need a name, or
identifier. There are some basic syntax rules to follow when
making identifiers.

 Names are case sensitive


 Names can contain letters, numbers, and underscores
 Names must begin with a letter or an underscore
 Names cannot contain whitespaces or special
characters (!, #, @, etc.)
 Names cannot use reserved keywords

DATA TYPES
Data types are the classifications for different kinds of data
you can use in a program. Data types tell our variables what
data they can store. There are three data types in C++:

 Primitive data types: these are the built-in data that you
can use to declare variables. They
include integer, character, boolean, floating
point, double floating point, void, and wide character.
 Derived data types: these are derived from the
primitive data types. They
include function, reference, array, and pointer.
 User-Defined data types: these are defined by you, the
programmer.
STRINGS
Strings are objects in C++. They are a set of characters
within ” “ quotes, like our ”Hello World” string. Since they are
objects, we can perform functions to them, like the length (
) function, which determines the length of a string.

OPERATORS
Operators are symbols that manipulate our data and
perform operations. In C++, we can overload operators to
make them work for programmer-defined classes.
Overloading an operator basically means that an operator
can have more than one function at a time. There are four
kinds of operators in the C++ language:

 Arithmetic Operators are used for mathematical


operations. These work just like algebraic symbols.
EX:
cout << x + y
meaning i-add mo lang ang x at y

 Assignment Operators are for assigning values to our


variables.
EX:
int x = 10
meaning ang equivalent ni x ay 10

Comparison Operators compare two values.


EX:
x <=y
meaning ang x ay mas mataas o magkapareho lang
sila ng y.
 Logical Operators determine the logic between values.
EX:
x < 4 && x <9
meaning magrereturn true kung ang parehong
statement ay parehong true sa x.

OBJECTS
An object is a collection of data that we can act upon. An
object in C++ has an attribute (its traits) and method (its
abilities). You construct objects using a class. Think of this like
a blueprint for an object.
You create a class using the class keyword. You must define
an access specifier, such as public, private, or protected.
The public keyword states that class is accessible from
outside that class. Once you define your class, you can
define your attributes and objects. Take a look below at an
example of a class and object.

FUNCTIONS
Functions are blocks of code that run when they are
invoked. They are the workhorse for your program and are
used to perform operations and manipulations on your
code.

They are extremely important for code reusability and help


to better modularize your code. Think of these like actions
that you initiate. In C++, there are predetermined functions,
like the main ( ) of our initial example.

To create a function, you have to give it a name (called the


declaration) and parentheses ( ). You can then invoke this
function at any point by using that name ( ).
There are a lot of ways to use functions. You can also attach
return values to your functions, which determine if a function
should output any information. The void keyword states that
there will be no return. The return keyword, on the other
hand, will call for a data type output.

CONDITIONAL STATEMENTS
These allow you to perform checks on whether a block of
code should be executed or not. There are four conditional
statements in C++:
 if: a certain action will be performed if a certain
condition is met
 else: a certain action will be performed instead if that
condition is not met
 else if: a new condition will be tested if the first is not
met
 switch: tests a variable against a list of values

LOOPS
Loops are similar to conditional statements. They execute
blocks of code as long as a certain condition is reached.
There are two types of loops in C++:

 while loops: this loop will continue to iterate through


your code while a condition returns true.
 for loops: this is used when you know the exact number
of times you want to loop in your code

You might also like