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

PDF
Operator overloading
DOCX
C++ file
PPTX
Few Operator used in c++
DOCX
PDF
2014 computer science_question_paper
PPT
Lecture#5 Operators in C++
DOCX
Oops practical file
Operator overloading
C++ file
Few Operator used in c++
2014 computer science_question_paper
Lecture#5 Operators in C++
Oops practical file

What's hot (20)

DOCX
PDF
Stl algorithm-Basic types
PDF
Implementing stack
DOC
Practical Class 12th (c++programs+sql queries and output)
PDF
C++ manual Report Full
DOCX
Cpp programs
DOC
PDF
Infix to Prefix (Conversion, Evaluation, Code)
DOCX
Computer Science Practical Science C++ with SQL commands
PDF
please sir i want to comments of every code what i do in eachline . in this w...
PPTX
Increment and Decrement operators in C++
PDF
201801 CSE240 Lecture 11
PPTX
C++20 features
PDF
Plsql programs(encrypted)
PPTX
Lecture 2 C++ | Variable Scope, Operators in c++
PDF
Lec21-CS110 Computational Engineering
PPTX
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
PDF
Inheritance and polymorphism
PDF
Week 5
PPTX
C++ operator
Stl algorithm-Basic types
Implementing stack
Practical Class 12th (c++programs+sql queries and output)
C++ manual Report Full
Cpp programs
Infix to Prefix (Conversion, Evaluation, Code)
Computer Science Practical Science C++ with SQL commands
please sir i want to comments of every code what i do in eachline . in this w...
Increment and Decrement operators in C++
201801 CSE240 Lecture 11
C++20 features
Plsql programs(encrypted)
Lecture 2 C++ | Variable Scope, Operators in c++
Lec21-CS110 Computational Engineering
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Inheritance and polymorphism
Week 5
C++ operator
Ad

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

PDF
C++ Programs
PPT
C++ chapter 2
PPT
Operator Overloading
PPT
c++ Lecture 2
PPTX
Operators in c++ programming types of variables
PPT
901131 examples
PPTX
Lec 2.pptx programing errors \basic of programing
PDF
Contoh program c++ kalkulator
PPTX
C++ Programm.pptx
PPTX
PROGRAMMING IN C - Operators.pptx
PPTX
Oops presentation
PPTX
Presentat ions_PPT_Unit-2_OOP.pptx
PPTX
Week7a.pptx
DOCX
Tugas praktikukm pemrograman c++
PDF
C101-PracticeProblems.pdf
PPT
Mastering Operator Overloading in C++...
PPTX
Expressions using operator in c
PPT
cpp input & output system basics
C++ Programs
C++ chapter 2
Operator Overloading
c++ Lecture 2
Operators in c++ programming types of variables
901131 examples
Lec 2.pptx programing errors \basic of programing
Contoh program c++ kalkulator
C++ Programm.pptx
PROGRAMMING IN C - Operators.pptx
Oops presentation
Presentat ions_PPT_Unit-2_OOP.pptx
Week7a.pptx
Tugas praktikukm pemrograman c++
C101-PracticeProblems.pdf
Mastering Operator Overloading in C++...
Expressions using operator in c
cpp input & output system basics
Ad

Recently uploaded (20)

PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Updated Idioms and Phrasal Verbs in English subject
PPTX
master seminar digital applications in india
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Trump Administration's workforce development strategy
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
RMMM.pdf make it easy to upload and study
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
History, Philosophy and sociology of education (1).pptx
Updated Idioms and Phrasal Verbs in English subject
master seminar digital applications in india
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Trump Administration's workforce development strategy
Orientation - ARALprogram of Deped to the Parents.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Weekly quiz Compilation Jan -July 25.pdf
Classroom Observation Tools for Teachers
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Microbial disease of the cardiovascular and lymphatic systems
RMMM.pdf make it easy to upload and study
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
STATICS OF THE RIGID BODIES Hibbelers.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf

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)