[go: up one dir, main page]

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

Introduction to C (2)

C++ is a powerful programming language created by Bjarne Stroustrup in the 1980s, known for its versatility in building applications from video games to operating systems. It emphasizes object-oriented programming and offers low-level access to system resources, making it suitable for high-performance applications. The document covers fundamental concepts such as syntax, variables, functions, and debugging, providing a foundation for aspiring programmers.

Uploaded by

al004120
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views20 pages

Introduction to C (2)

C++ is a powerful programming language created by Bjarne Stroustrup in the 1980s, known for its versatility in building applications from video games to operating systems. It emphasizes object-oriented programming and offers low-level access to system resources, making it suitable for high-performance applications. The document covers fundamental concepts such as syntax, variables, functions, and debugging, providing a foundation for aspiring programmers.

Uploaded by

al004120
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Introduction to

C++
Discover the powerful programming language C++,
used to build everything from video games to
operating systems. Dive into its rich history,
versatility, and bright future as we explore the
fundamentals.
The Creator of C++
C++ was created by Bjarne Stroustrup in the 1980s.
He developed C++ as an extension of the C
programming language to provide additional
features like object-oriented programming.
Stroustrup's work on C++ has had a significant
impact on the field of computer science and
software development.
Why learn C++?
1. C++ is a powerful and versatile language used to build everything

from video games to operating systems. It's a great choice for

aspiring programmers looking to develop a strong foundation in

computer science.

2. With its low-level access to system resources, C++ allows you to

create highly efficient and high-performance applications. This

makes it a popular choice for industries like finance, aerospace,

and gaming.

3. Learning C++ will teach you valuable programming concepts like

memory management, object-oriented design, and algorithm

optimization - skills that are highly sought after in the tech industry.
Games Created with
C++
1. Many of the world's most popular video
games, including Fortnite, Minecraft, and
Call of Duty MW: are built using the C++
2. programming language.
C++ is a powerful language that allows game
developers to optimize performance and access
low-level system resources, making it a preferred
choice for creating high-intensity, graphics-rich

3. gaming experiences.
Game engines like Unreal Engine that power AAA
titles are predominantly written in C++,
showcasing its versatility and suitability for
complex game development projects.
Hello World Tutorial
in C++
• Learn the basic syntax and structure of C++ programs.
• Write a simple "Hello, World!" program to get
started with C++.
• Understand the role of the main() function
and how to output text to the console.
Hello World!
#include<iostream> //adding a library

int main(){

std::cout<< "Hello World!"; // Outputing the phrase "Hello World!"

} //End

Output: Hello World!


Variables and Data
Types
In C++, you'll work with different types of data, like
numbers, text, and true/false values. These are
called variables, and you assign them names to
keep track of the information in your programs.

Variables are the building blocks of C++. You can


store all sorts of information in them - from simple
numbers to complex data structures. Mastering
variables and data types is key to becoming a
skilled C++ programmer.
Variables in C++
To add a variable in C++ you need to clarify the type
in our case int which is an integer(whole number)
and the name eg. x then you just enter :

int x = 5; //Declaring x

which would mean that x = 5.


Inputing Data in C++
• In C++, std::cin is the standard input stream
that allows users to input data into a program.
• It is used to read data of various types, such
as integers, floating-point numbers,
characters, and strings, from the keyboard or
• other input devices.
The std::cin operator reads input until it
encounters a whitespace character (space,
tab, or newline) and stores the input in the
specified variable.
Inputing Data
To input data, you use std::cin instead of out like with
hello world so you can write :

#include <iostream> //The Library

int main(){

int x; //Variable x

std::cin>> x; //Giving x a value

std::cout << x; //outputing x

} //end of code
Basic C++ Syntax
C++ has a simple but powerful syntax that allows
you to write clear, readable code. Each line of C++
code is a statement, and these statements are
grouped together into functions and classes. The
structure is similar to English, with keywords like
"if", "while", and "return" to control the flow of your
program.
To write C++ code, you'll use a text editor and a
compiler to turn your code into an executable
program. The compiler checks your syntax and
translates your high-level C++ instructions into the
low-level machine language that computers can
understand.
Operators and Expressions
Arithmetic Comparison Logical Expressions
Operators Operators Operators
An expression is a
C++ provides the Comparison Logical operators combination of
standard operators like like && (and), || variables,
arithmetic ==, !=, <, and > (or), and ! (not) let operators, and
operators like +, -, allow you to check you combine and values that
*, and / to perform if two values are negate different evaluates to a
calculations. You equal, not equal, conditions to single result.
can use these to less than, or make more Expressions are
add, subtract, greater than each complex decisions the building blocks
multiply, and other. in your code. of C++ programs,
divide numbers in allowing you to
your programs. perform all kinds
Functions and Parameters
What are Functions? Parameters
Functions are like mini- Parameters are special
programs within your C++ variables that you can pass
code. They allow you to group into a function. This lets the
related lines of code together function accept information
and give them a name. This from the outside world and use
makes your programs more it to do its job. Functions can
organized and easier to have multiple parameters of
understand. different types.
Careers with C++
1. Software Engineer: C++ is widely used for developing
system-level software, operating systems, and
performance-critical applications like video games,
financial trading platforms, and scientific simulations.

2. Game Developer: C++'s efficiency and low-level


control make it a popular choice for creating high-
performance, graphically-intensive video games for
consoles, PCs, and mobile devices.
3. A Developer with C++ has an average yearly salary
of: 136.000$
Fun fact: The Average salary of Cyprus is 41.000
Yearly
Object-
Oriented
Programming
in C++
C++ supports object-oriented programming (OOP),
a powerful paradigm that allows you to create
complex, modular, and reusable code. OOP focuses
on creating objects that encapsulate data and
behaviors, making your programs more organized
and easier to maintain.
Performance
Optimization in
C++
Maximizing the efficiency and speed of C++ code is
crucial for performance-critical applications.
Leveraging the language's low-level control,
developers can fine-tune their programs to run at
lightning-fast speeds.
C++ vs Other Languages
Efficiency Low-Level Versatility Legacy Support
Access
C++ offers From game C++ maintains
unparalleled C++ provides development to compatibility with
control over direct access to finance, scientific decades of
system resources, memory computing to existing code,
allowing management and operating allowing
developers to hardware-level systems, C++ is a developers to
optimize operations, versatile language build upon and
performance for making it a that can be used integrate with
time-sensitive, powerful choice in a wide range of established
resource- for systems domains. software
constrained programming and ecosystems.
applications. embedded
Debugging and Error Handling
1. Understand Compile-Time Errors - Catch mistakes in your code before it runs, like
syntax errors or type mismatches.
2. Debug Runtime Errors - Identify and fix problems that occur during program
execution, such as division by zero or out-of-bounds array access.
3. Implement Exception Handling - Use try/catch blocks to anticipate and gracefully
handle unexpected situations, preventing program crashes.
Conclusion and Next
Steps
Recap Key Concepts
We've covered the basics of C++, from
variables and data types to control flow and
object-oriented programming. These
foundational skills will serve you well as you
continue your programming journey.
See you Next Time!!!
Credits:
Admin:
Aris Louca

Evgenios
Th.
Theodosiou
David
Stepanya
n
Raphael
Nicolaos

You might also like