Procedure Oriented programming Object Oriented programming Basic Concept of Object Oriented programming A simple C++ Program Structure of C++ Program
sammahrasheed1
101 views
25 slides
Jul 19, 2024
Slide 1 of 25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
About This Presentation
C++ is a cross-platform language that can be used to create high-performance applications.
C++ was developed as an extension of C, and both languages have almost the same syntax.
The main difference between C and C++ is that C++ support classes and objects, while C does not.
C++ was developed by Bj...
C++ is a cross-platform language that can be used to create high-performance applications.
C++ was developed as an extension of C, and both languages have almost the same syntax.
The main difference between C and C++ is that C++ support classes and objects, while C does not.
C++ was developed by Bjarne Stroustrup, as an extension to the C language.
C++ gives programmers a high level of control over system resources and memory.
The language was updated 4 major times in 2011, 2014, 2017, and 2020 to C++11, C++14, C++17, C++20.
C++ is one of the world's most popular programming languages.
C++ can be found in today's operating systems, Graphical User Interfaces, and embedded systems.
C++ is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs.
C++ is portable and can be used to develop applications that can be adapted to multiple platforms.
C++ is fun and easy to learn!
As C++ is close to C, C# and Java, it makes it easy for programmers to switch to C++ or vice versa.
Google: C++ is used for lots of google magic like Big table, Google file system, Google Chromium browser, and MapReduce large cluster data processing are all written in C++.
Mozilla uses a subset of C++. C++ 14 is required to build Mozilla 59, Mozilla Firefox, and Thunderbird email chat client are both written using C++.
Microsoft: Lots of windows apps that you regularly use are written in C++, It features tools for developing and debugging C++ code, especially code written for the DirectX, Windows API, and .NET.
Rockstar Games: Almost all major game companies use C++ due to its right speed on bare metal. Many major game engines are fully written in C++ and leverage its speed and OOPs capabilities.
MongoDB: MongoDB is an open-source database, widely used as the back-end store for web applications, as well as in large enterprises like Viacom, biotechnology giants, and Disney.
Games and Animations: C++ is used for developing games. It simplifies the complexity of 3-Dimensional games and helps in optimizing the resources. � Procedure Oriented programming
Object Oriented programming
Basic Concept of Object Oriented programming
A simple C++ Program
Structure of C++ Program
Application of C++
Size: 475.01 KB
Language: en
Added: Jul 19, 2024
Slides: 25 pages
Slide Content
Govt Engineering College Ajmer INTRODUCTION TO C++ Presented by : prof Sammah rasheed
INDEX Procedure Oriented programming Object Oriented programming Basic Concept of Object Oriented programming A simple C++ Program Structure of C++ Program Application of C++
Difference between c and c++ C was developed by Dennis Ritchie between the year 1969 and 1973 at AT&T Bell Labs. C++ was developed by Bjarne Stroustrup in 1979. For the development of code, C supports procedural programming . C++ is known as hybrid language because C++ supports both procedural and object oriented programming paradigms . C is a function driven language because C is a procedural programming language. C++ is an object driven language because it is an object oriented programming. Standard IO header is stdio.h . Standard IO header is iostream.h . scanf() and printf () functions are used for input/output in C. cin and cout are used for input/output in C++ There are 32 keywords in the C There are 97 keywords in the C++ File extension is “.c” File extension is “.cpp” or “.c++” or “.cc” or “.cxx” C structures don’t have access modifiers. C ++ structures have access modifiers. Direct support for exception handling is not supported by C. Exception handling is supported by C++.
Object Oriented programming C++ is a cross-platform language that can be used to create high-performance applications. C++ was developed as an extension of C, and both languages have almost the same syntax. The main difference between C and C++ is that C++ support classes and objects, while C does not. C++ was developed by Bjarne Stroustrup , as an extension to the C language . C++ gives programmers a high level of control over system resources and memory. The language was updated 4 major times in 2011, 2014, 2017, and 2020 to C++11, C++14, C++17, C++20.
Why Use C++ C++ is one of the world's most popular programming languages. C++ can be found in today's operating systems, Graphical User Interfaces, and embedded systems. C++ is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs. C++ is portable and can be used to develop applications that can be adapted to multiple platforms. C++ is fun and easy to learn! As C++ is close to C , C# and Java , it makes it easy for programmers to switch to C++ or vice versa.
C++ Variables Variables are containers for storing data values. In C++, there are different types of variables (defined with different keywords), int - stores integers (whole numbers), without decimals, such as 123 or -123 double - stores floating point numbers, with decimals, such as 19.99 or -19.99 char - stores single characters, such as 'a' or 'B'. Char values are surrounded by single quotes string - stores text, such as "Hello World". String values are surrounded by double quotes bool - stores values with two states: true or false
Declaring (Creating) Variables
Declare Many Variables
C++ Identifiers All C++ variables must be identified with unique names . These unique names are called identifiers . Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume). The general rules for naming variables are: Names can contain letters, digits and underscores Names must begin with a letter or an underscore (_) Names are case-sensitive (myVar and myvar are different variables) Names cannot contain whitespaces or special characters like !, #, %, etc. Reserved words (like C++ keywords, such as int) cannot be used as names
Example
A simple C++ Program #include< iostream.h > includes the standard input output library functions. It provides cin and cout methods for reading from input and writing to output respectively. #include < conio.h > includes the console input output library functions. The getch() function is defined in conio.h file. void main() The main() function is the entry point of every program in C++ language. The void keyword specifies that it returns no value. cout << "Welcome to C++ Programming." is used to print the data "Welcome to C++ Program ming." on the console. getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.
Constants
continue
Constants When you declare a constant variable, it must be assigned with a value: const int minutesPerHour = 60;
C++ User Input cout is used to output (print) values. Now we will use cin to get user input. cin is a predefined variable that reads data from the keyboard with the extraction operator (>>). cout is pronounced "see-out". Used for output , and uses the insertion operator (<<) cin is pronounced "see-in". Used for input , and uses the extraction operator (>>)
Basic Concept of Object Oriented programming
CLASS AND OBJECT Class (Fruit) Classes and objects are the two main aspects of object-oriented programming. A class is a template for objects, and an object is an instance of a class. When the individual objects are created, they inherit all the variables and functions from the class.
Encapsulation in C++ Encapsulation in C++ is defined as the wrapping up of data and information in a single unit. In Object Oriented Programming, Encapsulation is defined as binding together the data and the functions that manipulate them. Two Important property of Encapsulation Data Protection Information Hiding
Data Abstraction Data Abstraction is a process of providing only the essential details to the outside world and hiding the internal details, i.e., representing only the essential details in the program . Let's take a real life example of AC, which can be turned ON or OFF, change the temperature, change the mode, and other external components such as fan, swing. But, we don't know the internal details of the AC, i.e., how it works internally. Thus, we can say that AC seperates the implementation details from the external interface.
Polymorphism The word “polymorphism” means having many forms Polymorphism is considered one of the important features of Object-Oriented Programming. . A real-life example of polymorphism is a person who at the same time can have different characteristics. A man at the same time is a father, a husband, and an employee. So the same person exhibits different behavior in different situations. This is called polymorphism.
INHERITANCE Inheritance is one of the key features of Object-oriented programming in C++. It allows us to create a new class (derived class) from an existing class (base class). The derived class inherits the features from the base class and can have additional features of its own. Inheritance is an is-a relationship . We use inheritance only if an is-a relationship is present between the two classes. Here are some examples: A car is a vehicle. Orange is a fruit. A surgeon is a doctor. A dog is an animal.
The derived class inherits the features from the base class
Derived Classes
Types Of Inheritance
Application of C++ Google : C++ is used for lots of google magic like Big table, Google file system, Google Chromium browser, and MapReduce large cluster data processing are all written in C++. Mozilla uses a subset of C++. C++ 14 is required to build Mozilla 59, Mozilla Firefox, and Thunderbird email chat client are both written using C++. Microsoft: Lots of windows apps that you regularly use are written in C++, It features tools for developing and debugging C++ code, especially code written for the DirectX, Windows API, and .NET. Rockstar Games: Almost all major game companies use C++ due to its right speed on bare metal. Many major game engines are fully written in C++ and leverage its speed and OOPs capabilities. MongoDB : MongoDB is an open-source database, widely used as the back-end store for web applications, as well as in large enterprises like Viacom, biotechnology giants, and Disney. Games and Animations : C++ is used for developing games. It simplifies the complexity of 3-Dimensional games and helps in optimizing the resources.