SlideShare a Scribd company logo
#include <iostream>
using namespace std;
int main()
{
char choice;
int a=7, b=2;
float op3=10.1,op4=5.4;
signed int x=4;
unsigned long int a1=10,b1=40;
signed long int a2=10,b2=8,c2=12,d2=15;
short int a3=4,b3=7,c3;
do{
cout<<"-------------------------------------------------------------n";
cout<<"A-Arithmetic Operators using Integer , Float & doublen";
cout<<"B-Increment & Decrement Operators signed Integern";
cout<<"C-Relational Operator Using unsigned long Integern";
cout<<"D-Logical Operator Using Signed long Integern";
cout<<"E-Bitwise Operator using signed Integern";
cout<<"F.Exitn";
cout<<"Enter Your Choice: ";
cin>>choice;
cout<<"-------------------------------------------------------------n";
switch(choice)
{
case 'A': cout<<"Arithmetic Operators using Integer & Floatn";
cout << "a + b = " << (a + b) << endl;
cout << "a - b = " << (a - b) << endl;
cout << "a * b = " << (a * b) << endl;
cout << "op3 / op4 = " << (op3 /op4) << endl;
cout << "a % b " << (a % b) << endl;
break;
case 'B': cout<<"Increment & Decrement Operators signed Integer "<< endl;
cout << "post Increment a++ is :" <<x++ << endl;
cout << "Post decrement a-- is :" <<x-- << endl;
cout << "pre Increment ++a is :" << ++x << endl;
cout << "Pre decrement --a is :" << --x << endl;
break;
case 'C': cout<<"Relational Operator Using unsigned long Integer"<< endl;
if (a1 == b1)
cout << "a1 == b1 is Equal" << endl;
else
cout << " a1 == b1 is not Equal" << endl;
if (a1 < b1)
cout << "a1 < b1 is true" << endl;
else
cout << "a1 < b1 is false" << endl;
break;
case 'D':cout<<"D-Bitwise Operator Using Signed long Integer"<< endl;
if((a2>b2)&&(c2<d2))
cout<<"Logical AND is Truen";
else
cout<<"Logical AND is Falsen";
if((a2<b2)||(c2<d2))
cout<<"Logical OR is Truen";
else
cout<<"Logical OR is Falsen";
break;
case 'E':cout<<"E-Bitwise Operator using Short Integer"<< endl;
c3=a3&b3;
cout<<"Result of a3 & b3 ="<<c3<<endl;
c3=a3|b3;
cout<<"Result of a3 | b3 ="<<c3<<endl;
c3=a3^b3;
cout<<"Result of a3 ^ b3 ="<<c3<<endl;
c3=a<<2;
cout<<"Result of a3 << 2 ="<<c3<<endl;
c3=b3>>2;
cout<<"Result of a3 >> 2 ="<<c3<<endl;
c3=~a3;
cout<<"Result of ~ a3 ="<<c3<<endl;
break;
case 'F':
exit(0);
}
}while(choice!='F');
return 0;
}
OUTPUT:
-------------------------------------------------------------
A-Arithmetic Operators using Integer , Float & double
B-Increment & Decrement Operators signed Integer
C-Relational Operator Using unsigned long Integer
D-Logical Operator Using Signed long Integer
E-Bitwise Operator using signed Integer
F.Exit
Enter Your ChoiceA
-------------------------------------------------------------
Arithmetic Operators using Integer & Float
a + b = 9
a - b = 5
a * b = 14
op3 / op4 = 1.87037
a % b 1
-------------------------------------------------------------
A-Arithmetic Operators using Integer , Float & double
B-Increment & Decrement Operators signed Integer
C-Relational Operator Using unsigned long Integer
D-Logical Operator Using Signed long Integer
E-Bitwise Operator using signed Integer
F.Exit
Enter Your ChoiceB
-------------------------------------------------------------
Increment & Decrement Operators signed Integer
post Increment a++ is :4
Post decrement a-- is :5
pre Increment ++a is :5
Pre decrement --a is :4
-------------------------------------------------------------
A-Arithmetic Operators using Integer , Float & double
B-Increment & Decrement Operators signed Integer
C-Relational Operator Using unsigned long Integer
D-Logical Operator Using Signed long Integer
E-Bitwise Operator using signed Integer
F.Exit
Enter Your ChoiceC
-------------------------------------------------------------
Relational Operator Using unsigned long Integer
a1 == b1 is not Equal
a1 < b1 is true
-------------------------------------------------------------
A-Arithmetic Operators using Integer , Float & double
B-Increment & Decrement Operators signed Integer
C-Relational Operator Using unsigned long Integer
D-Logical Operator Using Signed long Integer
E-Bitwise Operator using signed Integer
F.Exit
Enter Your ChoiceD
-------------------------------------------------------------
D-Bitwise Operator Using Signed long Integer
Logical AND is True
Logical OR is True
-------------------------------------------------------------
A-Arithmetic Operators using Integer , Float & double
B-Increment & Decrement Operators signed Integer
C-Relational Operator Using unsigned long Integer
D-Logical Operator Using Signed long Integer
E-Bitwise Operator using signed Integer
F.Exit
Enter Your ChoiceE
-------------------------------------------------------------
E-Bitwise Operator using Short Integer
Result of a3 & b3 =4
Result of a3 | b3 =7
Result of a3 ^ b3 =3
Result of a3 << 2 =28
Result of a3 >> 2 =1
Result of ~ a3 =-5
-------------------------------------------------------------
A-Arithmetic Operators using Integer , Float & double
B-Increment & Decrement Operators signed Integer
C-Relational Operator Using unsigned long Integer
D-Logical Operator Using Signed long Integer
E-Bitwise Operator using signed Integer
F.Exit
Enter Your ChoiceF
-------------------------------------------------------------
[Inferior 1 (process 575) exited normally]
(gdb)

More Related Content

What's hot (20)

C++
C++
Raj vardhan
 
Stl algorithm-Basic types
Stl algorithm-Basic types
mohamed sikander
 
Implementing stack
Implementing stack
mohamed sikander
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
Aman Deep
 
C++ manual Report Full
C++ manual Report Full
Thesis Scientist Private Limited
 
Cpp programs
Cpp programs
harman kaur
 
Worst
Worst
zeal4triumph
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
Ahmed Khateeb
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
Vishvjeet Yadav
 
please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...
hwbloom27
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++
Neeru Mittal
 
201801 CSE240 Lecture 11
201801 CSE240 Lecture 11
Javier Gonzalez-Sanchez
 
C++20 features
C++20 features
LogeekNightUkraine
 
Plsql programs(encrypted)
Plsql programs(encrypted)
Karunakar Singh Thakur
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
Himanshu Kaushik
 
Lec21-CS110 Computational Engineering
Lec21-CS110 Computational Engineering
Sri Harsha Pamu
 
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Inheritance and polymorphism
Inheritance and polymorphism
mohamed sikander
 
Week 5
Week 5
준성 조
 
C++ operator
C++ operator
veena_bhagyawani
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
Aman Deep
 
Infix to Prefix (Conversion, Evaluation, Code)
Infix to Prefix (Conversion, Evaluation, Code)
Ahmed Khateeb
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
Vishvjeet Yadav
 
please sir i want to comments of every code what i do in eachline . in this w...
please sir i want to comments of every code what i do in eachline . in this w...
hwbloom27
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++
Neeru Mittal
 
Lecture 2 C++ | Variable Scope, Operators in c++
Lecture 2 C++ | Variable Scope, Operators in c++
Himanshu Kaushik
 
Lec21-CS110 Computational Engineering
Lec21-CS110 Computational Engineering
Sri Harsha Pamu
 
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Inheritance and polymorphism
Inheritance and polymorphism
mohamed sikander
 

Similar to c++ program using All data type and operators (20)

OPERATORS UNDER C++ POWER POINT PRESENTATION
OPERATORS UNDER C++ POWER POINT PRESENTATION
sj9399037128
 
Cs1123 4 variables_constants
Cs1123 4 variables_constants
TAlha MAlik
 
power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"
sj9399037128
 
901131 examples
901131 examples
Jeninä Juco III
 
C Programming Language Part 4
C Programming Language Part 4
Rumman Ansari
 
Carry look ahead adder Explanation about Carry lookahead adder.ppt
Carry look ahead adder Explanation about Carry lookahead adder.ppt
ArunAntony58
 
Lecture 3
Lecture 3
Mohammed Saleh
 
C++ TUTORIAL 3
C++ TUTORIAL 3
Farhan Ab Rahman
 
C++ chapter 2
C++ chapter 2
SHRIRANG PINJARKAR
 
C++ TUTORIAL 4
C++ TUTORIAL 4
Farhan Ab Rahman
 
C language basics
C language basics
Milind Deshkar
 
Assignment 3
Assignment 3
Ayesha Bhatti
 
Lecture05 operator overloading-and_exception_handling
Lecture05 operator overloading-and_exception_handling
Hariz Mustafa
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
AnkitSinghRajput35
 
Pads lab manual final
Pads lab manual final
AhalyaR
 
Labsheet2 stud
Labsheet2 stud
rohassanie
 
C Operators
C Operators
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Operators and Expression
Operators and Expression
shubham_jangid
 
Fekra c++ Course #2
Fekra c++ Course #2
Amr Alaa El Deen
 
Data types and Operators Continued
Data types and Operators Continued
Mohamed Samy
 
Ad

Recently uploaded (20)

Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
LDMMIA GRAD Student Check-in Orientation Sampler
LDMMIA GRAD Student Check-in Orientation Sampler
LDM & Mia eStudios
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
LDMMIA GRAD Student Check-in Orientation Sampler
LDMMIA GRAD Student Check-in Orientation Sampler
LDM & Mia eStudios
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Publishing Your Memoir with Brooke Warner
Publishing Your Memoir with Brooke Warner
Brooke Warner
 
Ad

c++ program using All data type and operators

  • 1. #include <iostream> using namespace std; int main() { char choice; int a=7, b=2; float op3=10.1,op4=5.4; signed int x=4; unsigned long int a1=10,b1=40; signed long int a2=10,b2=8,c2=12,d2=15; short int a3=4,b3=7,c3; do{ cout<<"-------------------------------------------------------------n"; cout<<"A-Arithmetic Operators using Integer , Float & doublen"; cout<<"B-Increment & Decrement Operators signed Integern"; cout<<"C-Relational Operator Using unsigned long Integern"; cout<<"D-Logical Operator Using Signed long Integern"; cout<<"E-Bitwise Operator using signed Integern"; cout<<"F.Exitn"; cout<<"Enter Your Choice: "; cin>>choice; cout<<"-------------------------------------------------------------n"; switch(choice) { case 'A': cout<<"Arithmetic Operators using Integer & Floatn"; cout << "a + b = " << (a + b) << endl; cout << "a - b = " << (a - b) << endl; cout << "a * b = " << (a * b) << endl; cout << "op3 / op4 = " << (op3 /op4) << endl; cout << "a % b " << (a % b) << endl; break;
  • 2. case 'B': cout<<"Increment & Decrement Operators signed Integer "<< endl; cout << "post Increment a++ is :" <<x++ << endl; cout << "Post decrement a-- is :" <<x-- << endl; cout << "pre Increment ++a is :" << ++x << endl; cout << "Pre decrement --a is :" << --x << endl; break; case 'C': cout<<"Relational Operator Using unsigned long Integer"<< endl; if (a1 == b1) cout << "a1 == b1 is Equal" << endl; else cout << " a1 == b1 is not Equal" << endl; if (a1 < b1) cout << "a1 < b1 is true" << endl; else cout << "a1 < b1 is false" << endl; break; case 'D':cout<<"D-Bitwise Operator Using Signed long Integer"<< endl; if((a2>b2)&&(c2<d2)) cout<<"Logical AND is Truen"; else cout<<"Logical AND is Falsen"; if((a2<b2)||(c2<d2)) cout<<"Logical OR is Truen"; else cout<<"Logical OR is Falsen"; break; case 'E':cout<<"E-Bitwise Operator using Short Integer"<< endl; c3=a3&b3; cout<<"Result of a3 & b3 ="<<c3<<endl; c3=a3|b3; cout<<"Result of a3 | b3 ="<<c3<<endl;
  • 3. c3=a3^b3; cout<<"Result of a3 ^ b3 ="<<c3<<endl; c3=a<<2; cout<<"Result of a3 << 2 ="<<c3<<endl; c3=b3>>2; cout<<"Result of a3 >> 2 ="<<c3<<endl; c3=~a3; cout<<"Result of ~ a3 ="<<c3<<endl; break; case 'F': exit(0); } }while(choice!='F'); return 0; } OUTPUT: ------------------------------------------------------------- A-Arithmetic Operators using Integer , Float & double B-Increment & Decrement Operators signed Integer C-Relational Operator Using unsigned long Integer D-Logical Operator Using Signed long Integer E-Bitwise Operator using signed Integer F.Exit Enter Your ChoiceA ------------------------------------------------------------- Arithmetic Operators using Integer & Float a + b = 9 a - b = 5 a * b = 14 op3 / op4 = 1.87037 a % b 1 ------------------------------------------------------------- A-Arithmetic Operators using Integer , Float & double B-Increment & Decrement Operators signed Integer C-Relational Operator Using unsigned long Integer D-Logical Operator Using Signed long Integer E-Bitwise Operator using signed Integer F.Exit Enter Your ChoiceB ------------------------------------------------------------- Increment & Decrement Operators signed Integer post Increment a++ is :4 Post decrement a-- is :5 pre Increment ++a is :5
  • 4. Pre decrement --a is :4 ------------------------------------------------------------- A-Arithmetic Operators using Integer , Float & double B-Increment & Decrement Operators signed Integer C-Relational Operator Using unsigned long Integer D-Logical Operator Using Signed long Integer E-Bitwise Operator using signed Integer F.Exit Enter Your ChoiceC ------------------------------------------------------------- Relational Operator Using unsigned long Integer a1 == b1 is not Equal a1 < b1 is true ------------------------------------------------------------- A-Arithmetic Operators using Integer , Float & double B-Increment & Decrement Operators signed Integer C-Relational Operator Using unsigned long Integer D-Logical Operator Using Signed long Integer E-Bitwise Operator using signed Integer F.Exit Enter Your ChoiceD ------------------------------------------------------------- D-Bitwise Operator Using Signed long Integer Logical AND is True Logical OR is True ------------------------------------------------------------- A-Arithmetic Operators using Integer , Float & double B-Increment & Decrement Operators signed Integer C-Relational Operator Using unsigned long Integer D-Logical Operator Using Signed long Integer E-Bitwise Operator using signed Integer F.Exit Enter Your ChoiceE ------------------------------------------------------------- E-Bitwise Operator using Short Integer Result of a3 & b3 =4 Result of a3 | b3 =7 Result of a3 ^ b3 =3 Result of a3 << 2 =28 Result of a3 >> 2 =1 Result of ~ a3 =-5 ------------------------------------------------------------- A-Arithmetic Operators using Integer , Float & double B-Increment & Decrement Operators signed Integer C-Relational Operator Using unsigned long Integer D-Logical Operator Using Signed long Integer E-Bitwise Operator using signed Integer F.Exit Enter Your ChoiceF ------------------------------------------------------------- [Inferior 1 (process 575) exited normally] (gdb)