what is c++, features, ides telerik software academy academy.telerik.com learning and development

Post on 03-Jan-2016

217 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Introduction to C++What is C++, Features, IDEs

Telerik Software Academy

Telerik Software Academyacademy.telerik.com

Learning and Development

Table of Contents What is C++?

History, Concepts & Philosophy, Standards

C++ Basic Program Structure Entry point, libraries, namespaces

etc.

C++ Compilers & IDEs Code::Blocks

Visual Studio

C++ Features C libs, OOP, Templates, Exceptions,

Overloads

2

What is C++Fast, Mid-level, Multi-paradigm

Language

What is C++? (1) General purpose programming language Any field of application – science,

business, etc.

Compiles to binary Code directly executed on the

hardware

Statically typed All data is in predefined forms (data

types)

Data is represented in variables of data types

A variable is of only 1 data type through its lifespan

4

What is C++? (2) Multi-paradigm

Supports procedural programming (as in C)

Supports object-oriented programming

Some functional programming in C++11 (latest)

Created by Bjarne Stroustrup Originally "C with Classes", later

renamed

Built over pure C, not fully compatible though

5

C++ Programming Model (1)

Imperative, Multi-paradigm language

Programmer can mix and match Low-level memory access (down to

each byte)

Procedural code (functions, memory pointers, etc.)

Object-oriented code (classes, methods, objects, etc.)

6

C++ Philosophy Features immediately useful in the real world

Programmers free to pick their own style

Allowing useful features More important than preventing

misuse

Features you do not use you do not pay for

Programmer can specify undefined behavior

More: en.wikipedia.org/wiki/C++#Philosophy

7

C++ Standards C++ 98 – first standardized C++ version Still massively used today

C++ 03 – minor revision of 98, bug-fixes

C++ TR1 – specification of extensions to be included in next C++ version Not really a standard

C++ 11 – latest official revision Many new features and

improvements

Lambdas, range-based loops, etc.

8

C++ Program StructureEntry point, Including libraries,

Termination

C++ Program Structure Program entry point

C++ is free form – any ordering of program components is acceptable

C++ needs specific function to start from

The main function – entry point of the program No other function can be named

"main" Can receive command line

parameters Termination – main returns, the program stops The return value of main is the "exit

code“ 0 means no errors – informative, not

obligatory

10

11

Hello World – Example This is a classical "Hello World"

example in C++:#include <iostream>using namespace std;

int main(int argc, char * argv[]){ cout<<"Hello World!"<<endl;

return 0;}

12

Hello World – Example

#include <iostream>

using namespace std;

int main(int argc, char * argv[]){ cout<<"Hello World!"<<endl;

return 0;}

Include the input-output

library

Say we’re working with

std namespace (so we

don’t write std:: in

front of everything)

"main" function – our entry point

Parameters in

these brackets

are optional

Print to the console

For “main” 0 means everything went ok, terminating normally

C++ Hello WorldLive Demo

C++ IDEs and CompilersCompiling code, Integrated

Develompent Environments

C++ Compilers A C++ compiler turns C++ code to assembly i.e. translates C++ to machine

language An IDE is software assisting programming Has a Compiler, Linker, Debugger,

Code Editor Code organization, Tools,

Diagnostics There are lots of C++ compilers

Free, open-source, proprietary Most are embedded in IDEs Bjarne Stroustrup’s advice on

picking an IDE and compiler: stroustrup.com/compilers.html

15

C++ IDEs – Code::Blocks

Code::Blocks – free C & C++ IDE Used in International Olympiad in

Informatics

Comes with MinGW GCC compiler Currently no support for C++ 11

Lightweight Can compile single .cpp file

Can be used for bigger projects with many files, references, etc.

16

Code::BlocksLive Demo

C++ IDEs – Visual Studio

Visual Studio – proprietary IDE for MS stack

Supports latest C++ standards

Single tool for:

Writing code in many languages (C#, C++, …)

Using different technologies (Web, WPF, …)

For different platforms (.NET CF, Silverlight, …)

Full integration of most development activities (coding, compiling, testing, debugging, deployment, version control, ...)

18

Visual StudioLive Demo

C++ FeaturesNotable C++ Features, Supported in all

Standards

C++ Features Operators and operator overloading

Over 35 operators – arithmetic, bitwise, comparisons, logical, etc.

User types can redefine operators

Memory management

Static allocation (compile-time, stack)

Auto allocation (stack)

Dynamic allocation – new, delete (heap)

21

C++ Features Classes & Objects

Support for all OOP principles (inheritance, polymorpism, encapsulation, abstraction, virtuals)

Templates

Support for generic programming

22

C++ Features Standard library

Set of libraries, data structures and algorithms

Largely based on the STL

Exceptions Objects representing errors

Can interrupt control flow and propagate to handlers

Can be user-created23

форум програмиране, форум уеб дизайнкурсове и уроци по програмиране, уеб дизайн – безплатно

програмиране за деца – безплатни курсове и уроцибезплатен SEO курс - оптимизация за търсачки

уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop

уроци по програмиране и уеб дизайн за ученициASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC

безплатен курс "Разработка на софтуер в cloud среда"

BG Coder - онлайн състезателна система - online judge

курсове и уроци по програмиране, книги – безплатно от Наков

безплатен курс "Качествен програмен код"

алго академия – състезателно програмиране, състезания

ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NETкурсове и уроци по програмиране – Телерик академия

курс мобилни приложения с iPhone, Android, WP7, PhoneGap

free C# book, безплатна книга C#, книга Java, книга C#Дончо Минков - сайт за програмиранеНиколай Костов - блог за програмиранеC# курс, програмиране, безплатно

?

? ? ??

?? ?

?

?

?

??

?

?

? ?

Questions?

?

Introduction to C++

http://academy.telerik.com

top related