SlideShare a Scribd company logo
Rajkiya Engineering College
Ambedkar Nagar Uttar Pradesh
Presentation on:-
C and C++ Programming Basic
Presented by:- Purushottam Presented to:-
Roll no:- 2107370200033 Mrs:-Mona Rani
Branch:- Electrical Engineering Department Of Electrical Engg…..
Contents:-
 Introduction
 Data Types
 Operators
 C++ Conditions
 Function
 Classes and Objects
 Advantages
Introduction of C and C++
About C
 C is a general-purpose programming language created by Dennis Ritchie at the Bell
Laboratories in 1972. It is a very popular language, despite being old.
 The main reason for its popularity is because it is a fundamental language in the field of
computer science.
About 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.
Difference between C and C++
 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.
History
 C++ was developed by Bjarne Stroustrup at Bell Laboratories over a period
starting in 1979.
 Since C++ is an attempt to add object-oriented features (plus other
improvements) to C, earlier it was called as “C with Objects”.
 As the language developed, Stroustrup named it as C++ in 1983.
 The name C++ suggests “C incremented” (recall the ++ is an increment operator
of C).
Data Types
The data type is a collection of data with values having fixed values, meaning as well as
its characteristics
Operator
An operator is a symbol that operates on a value to perform specific
mathematical or logical computations.
Types of Operators
Relational Operator
Arithmetic Operator
Comparison Operator
Relational Operator
 The relational operators are used to compare two of the available values to understand
what relationship the pairs of values share.
Arithmetic Operator
 Arithmetic operators are used to perform common mathematical operations.
Example
int sum1 = 100 + 50; // 150 (100 + 50)
int sum2 = sum1 + 250; // 400 (150 + 250)
int sum3 = sum2 + sum2; // 800 (400 + 400)
Comparison Operator
 Comparison operators are used to compare two values (or variables). This is important in
programming, because it helps us to find answers and make decisions.
 The return value of a comparison is either 1 or 0, which means true (1) or false (0). These
values are known as Boolean values, and you will learn more about them in the Booleans
and If..Else chapter.
 In the following example, we use the greater than operator (>) to find out if 5 is greater
than 3:
Example
int x = 5;
int y = 3;
cout << (x > y); // returns 1 (true) because 5 is greater than 3
C++ Conditions-
 A conditional statement, also known as a selection statement, facilitates the making of
decisions on the basis of particular conditions.
 Less than: a < b
 Less than or equal to: a <= b
 Greater than: a > b
 Greater than or equal to: a >= b
 Equal to a == b
 Not Equal to: a != b
C++ has the following conditional Statement
Use if to specify a block of code to be executed, if a specified condition is true
Use else to specify a block of code to be executed, if the same condition is false
The if Statements
Use the if statement to specify a block of C++ code to be executed if a condition
is true.

Example
 int x = 20;
int y = 18;
if (x > y) {
cout << "x is greater than y";
}
The else Statement
Use the else statement to specify a block of code to be executed if the condition
is false.
 Example
int time = 20;
if (time < 18) {
cout << "Good day.";
} else {
cout << "Good evening.";
}
// Outputs "Good evening."
Function
 A function is a block of code which only runs when it is called.
 You can pass data, known as parameters, into a function.
 Functions are used to perform certain actions, and they are important for reusing code: Define the code once,
and use it many times.
 A function can be called multiple times:
 Example:-
 void myFunction() {
cout << "I just got executed!n";
}
int main() {
myFunction();
myFunction();
myFunction();
return 0;
}
// I just got executed!
// I just got executed!
// I just got executed!
Write a program to check
the number is even or odd
Program in C
#include <stdio.h>
int main()
{ int num;
printf("Enter an integer: ");
scanf("%d", &num);
// true if num is perfectly divisible by 2
if(num % 2 == 0)
printf("%d is even.", num);
else printf("%d is odd.", num);
return 0;
}
Output- Enter an integer
Program in C++
#include <iostream>
using namespace std; int main()
{ int a;
cout << "Enter the number: "; cin >> a; /* logic */
if (a % 2 == 0) {
cout << "The given number is EVEN" << endl; }
else {
cout << "The given number is ODD" << endl; } return 0; }
Program Output:
Enter the number: 8
The given number is EVEN
Advantage of C++
• Object-Oriented. C++ is an object-oriented programming
language which means that the main focus is on objects and
manipulations around these objects. ...
• Speed. ...
• Compiled. ...
• Rich Library Support. ...
• Pointer Support. ...
• Closer to Hardware.
Thank
You

More Related Content

Similar to C and C++ programming basics for Beginners.pptx (20)

PPTX
Chapter1.pptx
WondimuBantihun1
 
PPTX
KMK1093 CHAPTER 2.kkkpptx KMK1093 CHAPTER 2.kkkpptx
JessylyneSophia
 
PDF
Introduction to programming c and data structures
Pradipta Mishra
 
PPTX
C Programming Unit-1
Vikram Nandini
 
PPTX
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
G. H. Raisoni Academy of Engineering & Technology, Nagpur
 
PDF
learn basic to advance C Programming Notes
bhagadeakshay97
 
PDF
Object Oriented Programming Short Notes for Preperation of Exams
MuhammadTalha436
 
PPTX
Programming in C
Nishant Munjal
 
PPT
Lecture 2
Soran University
 
PPTX
C Programming Unit-2
Vikram Nandini
 
PPTX
B.sc CSIT 2nd semester C++ Unit2
Tekendra Nath Yogi
 
PPTX
Fundamental of programming Fundamental of programming
LidetAdmassu
 
PDF
Introduction to programming c and data-structures
Pradipta Mishra
 
PPTX
Sample for Simple C Program - R.D.Sivakumar
Sivakumar R D .
 
PPT
Ch2 introduction to c
Hattori Sidek
 
PDF
The New Yorker cartoon premium membership of the
shubhamgupta7133
 
PPT
C++ Language
Syed Zaid Irshad
 
PPTX
presentation_c_basics_1589366177_381682.pptx
KrishanPalSingh39
 
PPT
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
bhargavi804095
 
PPT
C material
tarique472
 
Chapter1.pptx
WondimuBantihun1
 
KMK1093 CHAPTER 2.kkkpptx KMK1093 CHAPTER 2.kkkpptx
JessylyneSophia
 
Introduction to programming c and data structures
Pradipta Mishra
 
C Programming Unit-1
Vikram Nandini
 
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
G. H. Raisoni Academy of Engineering & Technology, Nagpur
 
learn basic to advance C Programming Notes
bhagadeakshay97
 
Object Oriented Programming Short Notes for Preperation of Exams
MuhammadTalha436
 
Programming in C
Nishant Munjal
 
Lecture 2
Soran University
 
C Programming Unit-2
Vikram Nandini
 
B.sc CSIT 2nd semester C++ Unit2
Tekendra Nath Yogi
 
Fundamental of programming Fundamental of programming
LidetAdmassu
 
Introduction to programming c and data-structures
Pradipta Mishra
 
Sample for Simple C Program - R.D.Sivakumar
Sivakumar R D .
 
Ch2 introduction to c
Hattori Sidek
 
The New Yorker cartoon premium membership of the
shubhamgupta7133
 
C++ Language
Syed Zaid Irshad
 
presentation_c_basics_1589366177_381682.pptx
KrishanPalSingh39
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
bhargavi804095
 
C material
tarique472
 

Recently uploaded (20)

PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Ad

C and C++ programming basics for Beginners.pptx

  • 1. Rajkiya Engineering College Ambedkar Nagar Uttar Pradesh Presentation on:- C and C++ Programming Basic Presented by:- Purushottam Presented to:- Roll no:- 2107370200033 Mrs:-Mona Rani Branch:- Electrical Engineering Department Of Electrical Engg…..
  • 2. Contents:-  Introduction  Data Types  Operators  C++ Conditions  Function  Classes and Objects  Advantages
  • 3. Introduction of C and C++ About C  C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old.  The main reason for its popularity is because it is a fundamental language in the field of computer science. About 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. Difference between C and C++  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.
  • 4. History  C++ was developed by Bjarne Stroustrup at Bell Laboratories over a period starting in 1979.  Since C++ is an attempt to add object-oriented features (plus other improvements) to C, earlier it was called as “C with Objects”.  As the language developed, Stroustrup named it as C++ in 1983.  The name C++ suggests “C incremented” (recall the ++ is an increment operator of C).
  • 5. Data Types The data type is a collection of data with values having fixed values, meaning as well as its characteristics
  • 6. Operator An operator is a symbol that operates on a value to perform specific mathematical or logical computations. Types of Operators Relational Operator Arithmetic Operator Comparison Operator
  • 7. Relational Operator  The relational operators are used to compare two of the available values to understand what relationship the pairs of values share.
  • 8. Arithmetic Operator  Arithmetic operators are used to perform common mathematical operations. Example int sum1 = 100 + 50; // 150 (100 + 50) int sum2 = sum1 + 250; // 400 (150 + 250) int sum3 = sum2 + sum2; // 800 (400 + 400)
  • 9. Comparison Operator  Comparison operators are used to compare two values (or variables). This is important in programming, because it helps us to find answers and make decisions.  The return value of a comparison is either 1 or 0, which means true (1) or false (0). These values are known as Boolean values, and you will learn more about them in the Booleans and If..Else chapter.  In the following example, we use the greater than operator (>) to find out if 5 is greater than 3: Example int x = 5; int y = 3; cout << (x > y); // returns 1 (true) because 5 is greater than 3
  • 10. C++ Conditions-  A conditional statement, also known as a selection statement, facilitates the making of decisions on the basis of particular conditions.  Less than: a < b  Less than or equal to: a <= b  Greater than: a > b  Greater than or equal to: a >= b  Equal to a == b  Not Equal to: a != b C++ has the following conditional Statement Use if to specify a block of code to be executed, if a specified condition is true Use else to specify a block of code to be executed, if the same condition is false
  • 11. The if Statements Use the if statement to specify a block of C++ code to be executed if a condition is true.  Example  int x = 20; int y = 18; if (x > y) { cout << "x is greater than y"; }
  • 12. The else Statement Use the else statement to specify a block of code to be executed if the condition is false.  Example int time = 20; if (time < 18) { cout << "Good day."; } else { cout << "Good evening."; } // Outputs "Good evening."
  • 13. Function  A function is a block of code which only runs when it is called.  You can pass data, known as parameters, into a function.  Functions are used to perform certain actions, and they are important for reusing code: Define the code once, and use it many times.  A function can be called multiple times:  Example:-  void myFunction() { cout << "I just got executed!n"; } int main() { myFunction(); myFunction(); myFunction(); return 0; } // I just got executed! // I just got executed! // I just got executed!
  • 14. Write a program to check the number is even or odd Program in C #include <stdio.h> int main() { int num; printf("Enter an integer: "); scanf("%d", &num); // true if num is perfectly divisible by 2 if(num % 2 == 0) printf("%d is even.", num); else printf("%d is odd.", num); return 0; } Output- Enter an integer Program in C++ #include <iostream> using namespace std; int main() { int a; cout << "Enter the number: "; cin >> a; /* logic */ if (a % 2 == 0) { cout << "The given number is EVEN" << endl; } else { cout << "The given number is ODD" << endl; } return 0; } Program Output: Enter the number: 8 The given number is EVEN
  • 15. Advantage of C++ • Object-Oriented. C++ is an object-oriented programming language which means that the main focus is on objects and manipulations around these objects. ... • Speed. ... • Compiled. ... • Rich Library Support. ... • Pointer Support. ... • Closer to Hardware.