C/C++ is a procedural programming language developed in the 1970s. C++ builds on C and adds object-oriented programming capabilities. Some key differences between C and C++ include C++ supporting classes, function overloading, and operator overloading. C++ is commonly used to create operating systems, compilers, databases, games, and other application software. The document then discusses C++ history, creators, uses, data types, variables, operators, control flow statements like if/else and loops, arrays, and multi-dimensional arrays. It provides examples of C++ code and basics of the C++ programming language.
Learning c - An extensive guide to learn the C LanguageAbhishek Dwivedi
This document covers entire C language thoroughly. Its for all the students or professionals who would like to learn C or would like to brush up their knowledge with a quick recap.
This Document about is C Programming language. You will learn Operators in C.
Types of operators-
Arithmetic Operators
Relational Operators
Increment Operator
Decrement Operator
Logical Operators
Conditional Operator
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C Programming Training PPTs / PDFs for free.
Download free C Programming study material. Learn C Programming for free in 2 hours.
Learning c - An extensive guide to learn the C LanguageAbhishek Dwivedi
This document covers entire C language thoroughly. Its for all the students or professionals who would like to learn C or would like to brush up their knowledge with a quick recap.
This Document about is C Programming language. You will learn Operators in C.
Types of operators-
Arithmetic Operators
Relational Operators
Increment Operator
Decrement Operator
Logical Operators
Conditional Operator
Download this Presentation for free from www.ecti.co.in/downloads.html
No SIGN UP REQUIRED.
C Programming Training PPTs / PDFs for free.
Download free C Programming study material. Learn C Programming for free in 2 hours.
The C programming language is a structure oriented programming language, developed at Bell Laboratories in 1972 by Dennis Ritchie C programming language features were derived from an earlier language called “B” (Basic Co..
This course teaches engineering students how to program in C. I gave this course for several years in the framework of the "Advanced Technology Higher Education Network" / SOCRATES program.
The C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
This PPT is all about INTRODUCTION TO C LANGUAGE in which all basic topics are covered and the information present in this is refered from a book called "Let Us C" by YASHAVANT KANETKAR i.e. This PPT is having all important points of first chapter of "Let Us C". If any doubt plz ask us in comment.
This presentation is about the "Basics Of C++ Programming.". Anyone who wants to learn C++ programming can get basic information from this.Easy concepts for the one who wish to learn a C++ language. Its an easy programming language which is used for different purposes like softwares,OS etc..
Hope u get enough info about the basics of c++ :)
An introduction to the C programming language for the students of the course "HJ-82 Ontwerpen voor de optie multimedia en signaalverwerking: seminaries", taught by the authors at the Catholic University of Leuven.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
This Webinar is conduct by Learn 4 Earn Team
(Ali Raza Jilani & Hamza Ashraf)
In this Webinar Students can Prepare Mid Terms Exam of C++ and Insha Allah they will Get best Grades.
in the first discuss about Basics of C++
You can be Able to improve your Basics because if you have Strong basics then you can solve a big problem ion finger tips.
I hope you will learn much more new today
The C programming language is a structure oriented programming language, developed at Bell Laboratories in 1972 by Dennis Ritchie C programming language features were derived from an earlier language called “B” (Basic Co..
This course teaches engineering students how to program in C. I gave this course for several years in the framework of the "Advanced Technology Higher Education Network" / SOCRATES program.
The C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
JavaTpoint share a presentation of C Programming language for beginners and professionals. now in this slideshare you will be learned basics of c programming language, what is c programming language, history of c programming, installing turbo c, features of c programming language, datatypes of c language, operaters in c, control statement of c language, c language functions, c array, pointer in c programming, and structure and union.
This PPT is all about INTRODUCTION TO C LANGUAGE in which all basic topics are covered and the information present in this is refered from a book called "Let Us C" by YASHAVANT KANETKAR i.e. This PPT is having all important points of first chapter of "Let Us C". If any doubt plz ask us in comment.
This presentation is about the "Basics Of C++ Programming.". Anyone who wants to learn C++ programming can get basic information from this.Easy concepts for the one who wish to learn a C++ language. Its an easy programming language which is used for different purposes like softwares,OS etc..
Hope u get enough info about the basics of c++ :)
An introduction to the C programming language for the students of the course "HJ-82 Ontwerpen voor de optie multimedia en signaalverwerking: seminaries", taught by the authors at the Catholic University of Leuven.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
This Webinar is conduct by Learn 4 Earn Team
(Ali Raza Jilani & Hamza Ashraf)
In this Webinar Students can Prepare Mid Terms Exam of C++ and Insha Allah they will Get best Grades.
in the first discuss about Basics of C++
You can be Able to improve your Basics because if you have Strong basics then you can solve a big problem ion finger tips.
I hope you will learn much more new today
The objective of the Level 5 Diploma in Information Technology is to provide learners with an excellent foundation for a career in a range of organisations. It designed to ensure that each learner is ‘business ready’: a confident, independent thinker with detailed knowledge of Information Technology, and equipped with the skills to adapt rapidly to change.
#Code2Create series: C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports different ways of programming like procedural, object-oriented, functional, and so on.Start your programming journey and join us to learn C++ basics!
by Google Developers Group and Women Tech-markers Kuwait chapter:
Instagram and Twitter: @GDGWTMKUWAIT
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
2. History
• C is a programming Language which is developed during 1970 by Dennis
Ritchie . In the case of this language the data was not secured.
• C Language is not an object oriented language it is a procedural oriented
language. Now what is Object Oriented Language it will be discuss later.
• In C programming, a program can be divided into smaller programs called
functions. And it doesn't support Function overloading.
• C++ is also called as C with classes or we can say C++ is a C language with more
features.
3. History
• C++ is a middle-level programming language developed by BJARNE
STROUSTRUP starting in 1979 at Bell Labs. originally named C with Classes but
later it was renamed C++ in 1983.
C++ runs on a variety of platforms, such as Windows, Mac OS, and the various
versions of UNIX
Creator of C++ Language
4. Use of C++
C++ is being highly used to create computer programs like device drivers Anything
from art applications, music players and even video games. And etc.
Design Operating system
Design Language Compiler
Design Database
Utilities
Application Software
5. Difference Between C and C++
C is the function or procedure programming
language.
C++ is the object oriented programming language.
Top down approach is used in C. Bottom up approach is used in C++.
C is less secure than C++
C++ is secure, because oop's concept is available.
Here Data is hidden and can't be accessed by
external functions.
Features like function overloading and operator
overloading is not present.
C++ supports function overloading and operator
overloading.
C uses scanf() and printf() function for standard input
and output.
C++ uses cin>> and cout<< for standard input and
output.
6. CHARACTER SET
Letter A-Z both upper and lower case.digits form 0to 9
Ad the special charler like.
! * + @ $%^
7. Compiler and IDE for C++
What is compiler?
Computers understand only one language and that language consists of sets of
instructions made of ones and zeros. This computer language is appropriately
called machine language.
A single instruction to a computer could look like this:
00011101010101
If we want to give instruction to the computer for example 2+2=4 so
compiler convert our instruction to something shown bellow.
0010 + 0010 = 0100
8. Compiler in C++
A compiler is system software which converts programming language code into
binary format in single steps. In other words Compiler is a system software which
can take input from other any programming language and convert it into lower level
machine dependent language.
9. Interpreter & Assembler
It is system software which is used to convert programming language code into
binary format in step by step process
An assembler is system software which is used to convert the assembly language
instruction into binary format in step by step process. An assembler is system
software which is used to convert the assembly language instruction into binary
format.
10. What is IDE ?
IDEs are some tools which are use to write code for C++ for example
DEV C++, Turbo C++, Visual Studio, Eclipse and etc.
The Dev C++ is much famous for learning C++ that is why we use the Dev-C++
IDE (Integrated Development Environment)
Dev-C++ has its own compiler which is responsible for the conversion of your code
into machine language.
11. First Program In C++
This is a preprocessor directive. It tells
the preprocessor to include the contents
of iostream header file in the program
before compilation. This file is required
for input output statements.
This will be discuss later. For now it is
required to write it
The main function is responsible to begin
the program, it mean the program start
from here, it include body of your program.
“HELLOW “
12. Comments in C++
Each and every language will provide this great feature which is used to document
source code. We can create more readable and eye catching program structure
using comments. We should use as many as comments in C++ program.
Comment is non executable Statement in the C++.
We can have two types of comment in Programming
Single Line Comment
Multiple Line Comment
14. Data Types & Variables
While doing programming, you need to use variables to store information.
Variables are nothing but reserved memory locations to store values. This means
that when you create a variable you reserve some space in memory.
You may like to store information of various data types like character, wide
character, integer, floating point, double floating point, Boolean etc. Based on
the data type of a variable, the operating system allocates memory and decides
what can be stored in the reserved memory.
15. Data Types & Variables
Data means characteristic of a data. Bellow are some of the data types in C++,
Type Keyword Size reservation
Boolean bool 1 byte
Character char 1 byte
Short integer short int 2 bytes
Integer int 4 bytes
Floating point float 4 byte s
Double floating point double 8 byte s
17. Variable and Assignment
Assignment is a process through which we store some values to a variables. Assigning value
to a variable need two process
1. Variable Declaration
2. Variable initialization
What is variable Declaration?
Variable Declaration tell the system you have allocate a space by a specific name.
To declare a variable you need two things. Data Type and variable name (identifier).
For example int var1; char var2; double x; string y;
18. Variable and Assignment
What is variable initialization?
Variable initialization means assigning values to variable, it is the way how you can
insert values to the variable. For example
int x; //variable declaration
x=90; // variable initialization
Or
int x=80; //variable declaration + variable initialization
19. Examples
We can declare and initialize a variable through different ways
One Variable
More then one Variable
You can declare in
same line multiple
variables
You can declare
and initialize
multiple variable in
same line.
20. Keywords
Keywords are some reserve words in C++ programming which are already taken
by the certain language and you can not assign the reserved word to any variable,
function, class and etc.
Exapmle:
Int, cin, cout, iostream, double, string, include and etc.
But you can assign the name of variable as
Abc, khan, sname, password, username and etc
21. Constant
Constant are like variable, but once you assign a value to a content variable it is not
changeable. Where the variables are changing their values during the execution of a
program.
Example
const int x=90;
x=80; // this is an error
cout<< x;
22. Characters
Character is a single alphabet which takes only one byte in computer memory and it is
always define as bellow.
Syntax char variable_name;
Example char x;
x=‘Z’;
cout<<x;
23. Strings
String is the collection of characters, it is also called non-primitive data type and it
assume storage size depends on the character of string.
Syntax string variable_name;
Example string student_name;
student_name=“qarar khan”;
cout<<student_name;
24. cin/cout
cin and cout are not keywords, as you are beginner now in
this class just consider them as a keyword. cout means
console out. It is use to print something on the screen of your
system. We use the extraction operator(<<) with cout.
Reverse cin is use for input when you want to take something
from the user through keyboard. We use the insertion
operator (>>) with cin .
Example
25. Operator
Operator is a special symbol that tells the compiler to perform specific mathematical or
logical Operation.
These are the overall
C++ Operators, we are
going to discuss all of
them one by one with the
practical examples.
For now in this class we
covers the Arithmetic,
Unary and Relational
Operators. The others
will be debussed later
26. Arithmetic operator program
To understand the
arithmetical operators look
at this program.
For more example see the
video of this slide..
27. Increment & Decrement
Operators
The increment operator (++) adds 1 to its operand, and the decrement operator (--)subtracts
1 from its operand.
Both the increment and decrement operators can either Prefix or Postfix. There is an
important difference in prefix and postfix forms which will be discuss later
x = x+1; is the same as x++
x = x-1; is the same as x--
++x // Prefix increment form x++ // Postfix increment
form
29. if, if...else & nested if
The if, if...else and nested if...else statement are used to make one-time decisions in C++
Programming, use to execute some codes and ignore some codes depending upon the test
condition.
30. if Statement
The if statement checks whether
the test condition is true or not. If the
test condition is true, it executes the
code/s inside the body of if
statement. But it the test condition is
false, it skips the code/s inside the
body of if statement. The if keyword is followed by test condition inside
parenthesis ( ). If the test condition is true, the
codes inside curly bracket is executed but if test
condition is false, the codes inside curly bracket { }
is skipped and control of program goes just below
the body of if as shown in figure above
32. Else if Statement
This statement is executed when if statements
become fail. So the compiler checks for the else if
statement. Same if the first else if statement become
fail again it will check for the third else if statement,
same action will be perform. If none of the if and else
if statement become true then the last bock (else
block) will be execute.
34. Nested if Statement
When ever an if statement comes inside
of an if statement, it is called Nested if
statement. It means this has two test
condition for execution of a program.
See the example
36. Loops
When you need to execute a block of code several number
of times we use some statements which are called loops
statement. In fact loop statement allows you to execute a
statement or a group of statement multiple time.
following is the general form of a loop statement in most of
the programming language. Conditio
n
Body of loop
True
False
Exit from
loop
37. Types of Loop
C++ provide the following types of Loop statement.
1. While loop
2. For loop
3. Do while loop
4. Nested loop
38. While loop
A while loop statement repeatedly
executes a target statement as long as
a given condition is true
Syntax:
While (condition ){
Statements
}
Flow
Chart
40. For Loop
A for loop is a repetition control structure that
allows you to efficiently write a loop that needs to
execute a specific number of time.
Syntax:
for(initialization ; condition ; increment){
Statements;
}
Flow
Chart
42. Do… While loop
As we studied while and for loops, they were checking
for condition first and then execute the statement. But
do…while loop execute the statement and then it check
the condition for further execution.
Syntax:
do{
Statements;
}while (condition)
Flow
Chart
46. C++ Program Structure
C++ Programming language is most popular
language after C Programming language.
C++ is first Object oriented programming
language. structure of C++ Program is
discussed as bellow.
47. Section 1 : Header File Declaration
Section
1. Header files used in the program are listed here.
2. Header File provides Prototype declaration for different
library functions.
3. We can also include user define header file.
4. Basically all preprocessor directives are written in this
section.
48. Section 2 : Global Declaration Section
Global Variables are declared here.
Global Declaration may include
1. Declaring Structure
2. Declaring Class
3. Declaring Variable
49. Section 3 : Class Declaration Section
1. Actually this section can be
considered as sub section for the
global declaration section.
2. Class declaration and all methods
of that class are defined here.
50. Section 4 : Main Function
1. Each and every C++ program always
starts with main function.
2. This is entry point for all the function.
Each and every method is called
indirectly through main.
3. We can create class objects in the main.
4. Operating system call this function
automatically.
51. Section 5 : Method Definition Section
1. Normally this is optional in C++, use to write the
definition of a function, or we can say the body of a
function can be written here.
52. Switch
A switch statement allows a variable to be tested for equality against a list of values. Each
value is called a case, and the variable being switched on is checked for each case.
53. Switch Rules
The expression used in a switch statement must have an integral or enumerated
type.
You can have any number of case statements within a switch. Each case is
followed by the value to be compared to and a colon.
The constant-expression for a case must be the same data type as the variable in
the switch, and it must be a constant.
When the variable being switched on is equal to a case, the statements following
that case will execute until a break statement is reached.
54. Switch Rules
When a break statement is reached, the switch terminates, and the flow of control
jumps to the next line following the switch statement.
Not every case needs to contain a break. If no break appears, the flow of control
will fall through to subsequent cases until a break is reached.
A switch statement can have an optional default case, which must appear at the
end of the switch. The default case can be used for performing a task when none of
the cases is true. No break is needed in the default case.
56. Arrays
An array is a list of elements of the same data type, identified by a pair of square
brackets [ ]. To use an array, you need to declare the array with 3 things:
1. Array Type
2. Array name
3. Array Size
Instead of declaring individual variables, such as num0, num1, ..., and num99, you
declare one array variable such as numbers and use num[0], num[1], and ... num[99]
to represent individual variables. A specific element in an array is accessed by an
index
57. Array Declaration
To declare an array in C++, the programmer specifies the type of the elements and the
number of elements required by an array as follows:
Type arrayName[arraylength];
int num[10];
This is called a single-
dimension array.
The arraySize must be an
integer constant greater than
zero and type can be any
valid C++ data type. For
example, to declare a 10-
element array we use the this
statement.
58. Initializing Arrays:
Array elements can be initialize one by one or using a single
statement as follows:
Direct Initialization
int num[5]={20,30,40,50,70};
Initialization by Index
num[0]=20;
num[1]=30;
num[2]=40;
num[3]=50;
num[4]=60;
num[5]=70
Printing array
Cout<<num[0]<<endl;
Cout<<num[1]<<endl;
Cout<<num[2]<<endl;
Cout<<num[3]<<endl;
Cout<<num[4]<<endl;
59. Initializing Arrays
An element is accessed by index number of an array. This is done by placing the index of the
element within square brackets after the name of the array.
For example: int num[9];
The above statement will take 9 elements. So here is an example that cover the declaration,
and initialization of the array by index number.
num
10 20 30 40 50 60 70 18 90
Num[0
]
Num[1
]
Num[2
]
Num[3
]
Num[4
]
Num[5
]
Num[6
]
Num[7
]
Num[8
]
60. Initialization with loops
int num[9];
for(int i=0;i<10;i++){
cin>>num[i]=i;
}
for(int i=0;i<10;i++){
cout<<num[i]<<endl;
}
Output
123456789
Or
1
2
3
4
5
6
7
8
9
62. Initialization of 2D arrays
Direct Initialization
int num[3][3]={{2,3,4},{8,9,7},{22,33,44}};
Or
Through index number
Num[0][0]=90
Num[]0[1]=90
Num[0][2]=90
Num[]1[0]=90
Num[1][1]=90
Num[1][2]=90
Printing 2D array
Cout<<num[0][0]<<endl;
Cout<<num[0] [1]<<endl;
Cout<<num[0] [2]<<endl;
Cout<<num[1] [0]<<endl;
Cout<<num[1] [1]<<endl;
64. Methods/Functions
Sometime a portion of code has to use many times. Instead of re-writing the codes
many times, it is better to put them into a "subroutine", and "call" them many times.
The benefits of using functions are:
Avoid repeating codes: It is easy to copy and paste.
Software Re-use: you can reuse the functions in other programs, by packaging them
into library codes.
65. Methods/Functions
A function is a group of statements that together perform a task. Every C++ program
has at least one function, which is main(), and all the most programs can define
additional functions, so each function performs a specific task.
There are two types of functions
1. User define Function
2. Built-in function or Standard library function
66. User Define Functions
Every User define function has three parts
1. Declaration of a function
2. Definition of a function
3. Calling of a function
A function declaration tells the
compiler about a function's
name, return type, and
parameters
A function definition provides
the actual body of the function.
A function calling is use to call
the function or we can say a
function calling is use to tell the
function to preform its task.
A function which is declare by the user according to hisher requirements is
called user define functions
67. Example
#....
Using namespace std;
void show(); // function declaration
main(){
Show(); // function calling
}
Void show(){ // function definition
int number=90;
Cout<<“welcome to this program..!!<< number;
}
This is a user define function with
no return type and no parameter.
68. Syntax of a user define function
return_type function_name( parameter_list){
Body of a function
Return value;
}
Return Type: A function may return a value.
The return_type is the data type of the value the function
returns. Some function may not return if you use the void
keyword
Function Name: This is the actual name of the function.
Parameters: function take argument values. And further
perform a task on values.
Function Body: The function body contains a collection of
statements that define what the function does.
69. User define function types
Bellow the User define functions
1. Functions with no arguments and no return type.
2. Functions with arguments and with no return type.
3. Functions with no arguments and a return type.
4. Functions with arguments and with return type.
70. User define function types
1. Functions with no arguments and no return type.
These are the functions, which do not take any data item from calling function, in the form of
parameters and do not return anything to calling function, after execution. Example
void display(); // declaring of function
main(){
display(); //calling of function
}
void display(){ //definition of function
int a=10, b=20, c=a+b;
Cout<<“welcome “<<c;
}
71. User define function types
2. Functions with arguments and with no return type.
This type of function can take some values from the calling function means main
function.
void add(int a, int b); // declaring of function
main(){
add(60,50); //calling of function
}
void add(int a, int b){ //definition of function
Int add= a+b;
Cout<<“a + b = “ <<add;
}
72. User define function types
3. Functions with no arguments and a return type.
This type of function can only return a value and it is not going to take any parameter, must
be noted that a function only return one value.
int sub(); // declaring of function
main(){
sub(); //calling of function
}
int sub(){ //definition of function
int salary=900, tax=100, pay=salary-tax;
Return pay;
}
73. User define function types
4. Functions with arguments and with return type.
This type of functions takes values as parameter from the calling function. After execution,
they return some value to the main function.
int total(int x, int y); // declaring of function
main(){
total(500,200); //calling of function
}
int total(int x, int y){ //definition of function
int z=x+y;
Return z;
}
74. Inline Functions
Inline Function is powerful concept in C++ programming language. If a function is
inline, the compiler places a copy of the code of that function at each point where the
function is called at compile time.
To make any function inline function just use inline keyword before the function return
type.
Why we use Inline functions?
Whenever we call any function many time then, it take a lot of extra time in execution
of series of instructions such as saving the register, pushing arguments, returning to
calling function. To solve problem we use inline functions. The main advantage of
inline function is it make the program faster.
76. Some basic program
Write a program to print HELLO WORLD on screen.
Source Code
#include<iostream> using namespace std; int main() { cout<<"Hello world"; return
0; }
77. Write a program to display output using a single cout statement.
Source Code
#include<iostream> using namespace std; int main() { cout<<"subject "
<<"tmarks"<<"nmathematict" <<90<<"ncomputert"<<77<<"nchemistryt"<<69;
return 0; }
78. Write a program which accept two numbers and print their sum.
Source Code
#include<iostream> using namespace std; int main() { int a,b,c; cout<< "nEnter
first number : "; cin>>a; cout<<"nEnter second number : "; cin>>b; c=a+b;
cout<<"nThe Sum is : "<<c; return 0; }
79. C++ Program to Check if a Number is
Positive or Negative
#include<iostream>
using namespace std;
int main ()
{
int num;
cout << "Enter the number to be checked : ";
cin >> num;
if (num >= 0)
cout << num << " is a positive number.";
else
cout << num << " is a negative number.";
return 0;
}
80. Find Number is Even or Odd using if else
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter an integer: ";
cin >> n;
if ( n % 2 == 0)
cout << n << " is even.";
else
cout << n << " is odd.";
return 0; }
81.
82.
83.
84. Pointers
Pointers are the powerful feature of C++ programming which differs it from other
popular programming languages like: Java, Visual Basic etc.
To understand pointers, you should have the knowledge of address in computer
memory.
Computer memory is broken down into bytes and each byte has its own address.
For example: In 1KB memory, there are 1024 bytes and each byte is given an
address (0 - 1023).
85. Example
The & operator can find address
occupied by a variable. If a, b are
variables then, &a and &b gives the
address of those variables.
86. Pointer Variable
Consider a normal variable as int a=40, these variables holds data. But pointer
variables are the special types of variable that holds memory address instead of
data. To declare pointer variable use : int *p; OR int* p;
// example
int a=100;
int *ptr;
ptr=&a;
cout<<ptr;
87. Pointer to an array
Pointers are the variables that hold
address. Pointers can point at cells
of an array not only single variable
int a[5];
int* ptr;
ptr = &a[2];
To access the address of the all
elements in array we use the for loop
int arr[5];
int *ptr;
For(int i=0;i<=5;i++){
ptr= &arr[i];
cout<<ptr<<endl;
}
88. Pointer to 2D arrays
int table[5][5];
int *ptr;
for(int r=0;r<5;r++){
for(int c=0; c<5; c++){
ptr=&table[r][c]<<endl;
}
}
This example describe you
how you can access the
address in two denominational
arrays.
89. Pointers to a function
In pervious, you learned about passing
arguments to a function. Which pass an actual
value to the function. There is another way of
passing argument in which actual value is not
passed, only the reference to that value is
passed. Consider this example
Here we passed the reference of
the variable to the function
90. Passing Pointers to a function
Now in this example we pass a pointer
variable to a function instead of the
actual value and reference.
92. Structures in C++
Structure is the collection of variables of different data types under a single name
for better visualization of problem. Arrays is also collection of data but arrays can
hold data of only one type whereas structure can hold data of one or more types.
The struct keyword defines a structure type followed by an identifier(name of the
structure). Then inside the curly braces, you can declare one or more members
(declare variables inside curly braces) of that structure.
94. Pointer to Structures
structures can be accessed along with pointers. A pointer variable of
structure can be created as below
Here, the pointer variable of type struct person is created.
Structure's member can be access through pointer can be used in two
ways:
1. Referencing pointer to another address to access memory
2. Using dynamic memory allocation
95. Referencing pointer to
another address to access
memory
Referencing pointer to another address
means we are accessing the data member of
a structure through pointers, we have to
declare a structure pointer and after all we
can access the data member of a structure by
(*ptr). Operator and -> operator.
See the example to understand more.
Or
96. Recursion
Recursion is a programming technique that allows the programmer to express operation
in terms of themselves. In C++ this takes the form of a function that calls it salves. A
useful way to think of recursive function is to consider it as a process being performed
where one instruction is repeated, it look like a loop because it repeat some code.
void recurse() { recurse(); //Function calls itself } int main { recurse(); //Sets off the recursion }
void recurse(){
recurse(); //Function calls itself
}
int main(){
recurse(); //Sets off the recursion
}
98. Type casting
Typecasting is the concept of converting the value of one type into another type. For
example, you might have a float that you need to use in a function that requires an integer.
Implicit conversion
It an automatically conversion, done by compiler, It can cause lose of data.
Explicit conversion
This process is also called type casting and it is user-defined. Here the user can typecast
the result to make it of a particular data type. In C++, it can be done by two ways
Converting by assignment
Conversion using Cast operator:
99. Converting by assignment
This is done by explicitly defining the required type in front of the expression in
parenthesis. This can be also considered as forceful casting.
Syntax: (type) expression
100. Conversion using Cast operator
A Cast operator is an unary operator which forces one data type to be converted into
another data type.
C++ supports four types of casting
Static Cast
Dynamic Cast
Const Cast
Reinterpret Cast OOP
101. Description for Casting
const_cast<type> (expr): The const_cast operator is used to explicitly override const and/or
volatile in a cast. The target type must be the same as the source type except for the alteration
of its const or volatile attributes. This type of casting manipulates the const attribute of the
passed object, either to be set or removed.
dynamic_cast<type> (expr): The dynamic_cast performs a runtime cast that verifies the
validity of the cast. If the cast cannot be made, the cast fails and the expression evaluates to
null. A dynamic_cast performs casts on polymorphic types and can cast a A* pointer into a B*
pointer only if the object being pointed to actually is a B object.
reinterpret_cast<type> (expr): The reinterpret_cast operator changes a pointer to any other
type of pointer. It also allows casting from pointer to an integer type and vice versa.
static_cast<type> (expr): The static_cast operator performs a nonpolymorphic cast. For
example, it can be used to cast a base class pointer into a derived class pointer.
102. Description for Casting
All of the above-mentioned casting operators will be used while working with
classes and objects. For now, try the following example to understand a simple
cast operators available in C++.
Float x=90.40;
Int y=x;
Cout<<y;
103. Header files
Header files contain definitions of Functions and Variables, which is imported or
used into any C++ program by using the pre-processor #include statement.
Header file have an extension ".h" which contains C++ function declaration and
macro definition.
Types of Header Files in C++
System header files: It is comes with compiler.
User header files: It is written by programmer.
104. Preprocessor Directives
The preprocessors are the directives, which give instruction to the compiler to
preprocess the information before actual compilation starts.
All preprocessor directives begin with #, and only white-space characters may
appear before a preprocessor directive on a line. Preprocessor directives are not
C++ statements, so they do not end in a semicolon (;).
You already have seen a #include directive in all the examples. This macro is
used to include a header file into the source file.
There are number of preprocessor directives supported by C++ like #include,
#define, #if, #else, #line, etc. Let us see important directives:
105. The #define Preprocessor
The #define preprocessor directive creates symbolic
constants. The symbolic constant is called a macro and
the general form of the directive is:
#define macro-name replacement-text
When this line appears in a file, all subsequent
occurrences of macro in that file will be replaced by
replacement-text before the program is compiled. For
example:
107. Using namespace std;
A namespace is a declarative region that provides a
scope to the identifiers (the names of types,
functions, variables, etc) inside it. It prevent name
collisions that can occur especially when your code
base includes multiple libraries.
Lets watch the video to understand
it practically