Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is C++, Features, IDEs

Similar presentations


Presentation on theme: "What is C++, Features, IDEs"— Presentation transcript:

1 What is C++, Features, IDEs
Introduction to C++ What is C++, Features, IDEs Telerik Software Academy Learning and Development Telerik Software Academy academy.telerik.com

2 Table of Contents What is C++? C++ Basic Program Structure
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

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

4 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

5 What is C++? (2) Multi-paradigm Created by Bjarne Stroustrup
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

6 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.)

7 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

8 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.

9 Entry point, Including libraries, Termination
C++ Program Structure Entry point, Including libraries, Termination

10 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

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 the input-output library
Say we’re working with std namespace (so we don’t write std:: in front of everything) #include <iostream> using namespace std; int main(int argc, char * argv[]) { cout<<"Hello World!"<<endl; return 0; } Parameters in these brackets are optional "main" function – our entry point Print to the console For “main” 0 means everything went ok, terminating normally

13 C++ Hello World Live Demo

14 Compiling code, Integrated Develompent Environments
C++ IDEs and Compilers Compiling code, Integrated Develompent Environments

15 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

16 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.

17 Code::Blocks Live Demo

18 C++ IDEs – Visual Studio
* 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, ...) (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

19 Visual Studio Live Demo

20 Notable C++ Features, Supported in all Standards

21 C++ Features Operators and operator overloading Memory management
* 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) (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

22 C++ Features Classes & Objects Templates
* C++ Features Classes & Objects Support for all OOP principles (inheritance, polymorpism, encapsulation, abstraction, virtuals) Templates Support for generic programming (c) 2007 National Academy for Software Development - All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

23 C++ Features Standard library Exceptions
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-created

24 Introduction to C++


Download ppt "What is C++, Features, IDEs"

Similar presentations


Ads by Google