SlideShare a Scribd company logo
1 of 8
#include <iostream>
using namespace std;
double sumNums(double num1, double num2);
double subNums(double num1, double num2);
double multNums(double num1, double num2);
double divNums(double num1, double num2);
int main()
{
char op;
float num1, num2;
cout << "Enter + for addition nEnter - for subtraction
nEnter * for multiplication nEnter / for division nEnter O to
show previous five operators nEnter E to exit" << endl;
cout << "nChoose an option: ";
cin >> op;
cout << "Enter first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
switch(op)
{
case '+':
cout << "" << num1 << " + " << num2 << " = "
<< sumNums(num1, num2) << endl;
break;
case '-':
cout << "" << num1 << " - " << num2 << " = "
<< subNums(num1, num2) << endl;
break;
case '*':
cout << "" << num1 << " * " << num2 << " = "
<< multNums(num1, num2) << endl;
break;
case '/':
cout << "" << num1 << " / " << num2 << " = "
<< divNums(num1, num2) << endl;
break;
case 'E':
cout << "Thank you";
break;
default:
cout << "Select a valid menu option" << endl;
break;
}
while(op != 'E')
{
cout << "nEnter + for addition nEnter - for
subtraction nEnter * for multiplication nEnter / for division
nEnter O to show previous five operators nEnter E to exit" <<
endl;
cout << "nChoose an option: ";
cin >> op;
cout << "Enter first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
switch(op)
{
case '+':
cout << "" << num1 << " + " << num2 << " = "
<< sumNums(num1, num2) << endl;
break;
case '-':
cout << "" << num1 << " - " << num2 << " = "
<< subNums(num1, num2) << endl;
break;
case '*':
cout << "" << num1 << " * " << num2 << " = "
<< multNums(num1, num2) << endl;
break;
case '/':
cout << "" << num1 << " / " << num2 << " = "
<< divNums(num1, num2) << endl;
break;
case 'E':
cout << "Thank you";
break;
default:
cout << "Select a valid menu option" << endl;
break;
}
}
return 0;
}
double sumNums(double num1, double num2)
{
double sum;
sum = 0;
sum = num1 + num2;
return sum;
}
double subNums(double num1, double num2)
{
double dif;
dif = 0;
dif = num1 - num2;
return dif;
}
double multNums(double num1, double num2)
{
double prod;
prod = 0;
prod = num1 * num2;
return prod;
}
double divNums(double num1, double num2)
{
double quot;
quot = 0;
quot = num1 / num2;
return quot;
}

More Related Content

Similar to #include iostreamusing namespace std;double sumNums(

Lab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docxLab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docxsmile790243
 
Start with the inclusion of libraries#include iostream .docx
 Start with the inclusion of libraries#include iostream .docx Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docxMARRY7
 
Programa Sumar y Multiplicar
Programa Sumar y MultiplicarPrograma Sumar y Multiplicar
Programa Sumar y MultiplicarAnais Rodriguez
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdfT17Rockstar
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentesmfuentessss
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfseoagam1
 
Nesting of for loops using C++
Nesting of for loops using C++Nesting of for loops using C++
Nesting of for loops using C++prashant_sainii
 
ch4_additional.ppt
ch4_additional.pptch4_additional.ppt
ch4_additional.pptLokeshK66
 
7segment scetch
7segment scetch7segment scetch
7segment scetchBang Igo
 
#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docxmayank272369
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)Sena Nama
 

Similar to #include iostreamusing namespace std;double sumNums( (20)

Ch4
Ch4Ch4
Ch4
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Inc decsourcefile
Inc decsourcefileInc decsourcefile
Inc decsourcefile
 
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docxLab Assignment #6, part 3 Time ConversionProgram Name lab.docx
Lab Assignment #6, part 3 Time ConversionProgram Name lab.docx
 
Start with the inclusion of libraries#include iostream .docx
 Start with the inclusion of libraries#include iostream .docx Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
 
Project in programming
Project in programmingProject in programming
Project in programming
 
Algo
AlgoAlgo
Algo
 
oop Lecture 4
oop Lecture 4oop Lecture 4
oop Lecture 4
 
Programa Sumar y Multiplicar
Programa Sumar y MultiplicarPrograma Sumar y Multiplicar
Programa Sumar y Multiplicar
 
C++ TUTORIAL 4
C++ TUTORIAL 4C++ TUTORIAL 4
C++ TUTORIAL 4
 
C101-PracticeProblems.pdf
C101-PracticeProblems.pdfC101-PracticeProblems.pdf
C101-PracticeProblems.pdf
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
 
Please use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdfPlease use the code below and make it operate as one program- Notating.pdf
Please use the code below and make it operate as one program- Notating.pdf
 
Nesting of for loops using C++
Nesting of for loops using C++Nesting of for loops using C++
Nesting of for loops using C++
 
ch4_additional.ppt
ch4_additional.pptch4_additional.ppt
ch4_additional.ppt
 
BScPLSQL.pdf
BScPLSQL.pdfBScPLSQL.pdf
BScPLSQL.pdf
 
Binomial heap
Binomial heapBinomial heap
Binomial heap
 
7segment scetch
7segment scetch7segment scetch
7segment scetch
 
#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx
 
Practiceproblems(1)
Practiceproblems(1)Practiceproblems(1)
Practiceproblems(1)
 

More from troutmanboris

Christian Schussele Men of ProgressOil on canvas, 1862Coope.docx
Christian Schussele  Men of ProgressOil on canvas, 1862Coope.docxChristian Schussele  Men of ProgressOil on canvas, 1862Coope.docx
Christian Schussele Men of ProgressOil on canvas, 1862Coope.docxtroutmanboris
 
Christian EthicsChristian ethics deeply align with absolutism. E.docx
Christian EthicsChristian ethics deeply align with absolutism. E.docxChristian EthicsChristian ethics deeply align with absolutism. E.docx
Christian EthicsChristian ethics deeply align with absolutism. E.docxtroutmanboris
 
Christian Ethics BA 616 Business Ethics Definiti.docx
Christian Ethics BA 616 Business Ethics Definiti.docxChristian Ethics BA 616 Business Ethics Definiti.docx
Christian Ethics BA 616 Business Ethics Definiti.docxtroutmanboris
 
CHPSI think you made a really good point that Howard lacks poli.docx
CHPSI think you made a really good point that Howard lacks poli.docxCHPSI think you made a really good point that Howard lacks poli.docx
CHPSI think you made a really good point that Howard lacks poli.docxtroutmanboris
 
Chrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docx
Chrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docxChrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docx
Chrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docxtroutmanboris
 
Chosen brand CHANELStudents are required to research a fash.docx
Chosen brand CHANELStudents are required to research a fash.docxChosen brand CHANELStudents are required to research a fash.docx
Chosen brand CHANELStudents are required to research a fash.docxtroutmanboris
 
Chose one person to reply to ALBORES 1. Were Manning’s acti.docx
Chose one person to reply to ALBORES 1. Were Manning’s acti.docxChose one person to reply to ALBORES 1. Were Manning’s acti.docx
Chose one person to reply to ALBORES 1. Were Manning’s acti.docxtroutmanboris
 
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docx
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docxChoosing your literary essay topic on Disgrace by J. M. Coetzee .docx
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docxtroutmanboris
 
Choosing your Philosophical Question The Final Project is an opp.docx
Choosing your Philosophical Question The Final Project is an opp.docxChoosing your Philosophical Question The Final Project is an opp.docx
Choosing your Philosophical Question The Final Project is an opp.docxtroutmanboris
 
Choosing Your Research Method in a NutshellBy James Rice and.docx
Choosing Your Research Method in a NutshellBy James Rice and.docxChoosing Your Research Method in a NutshellBy James Rice and.docx
Choosing Your Research Method in a NutshellBy James Rice and.docxtroutmanboris
 
Choose two of the systems (education, work, the military, and im.docx
Choose two of the systems (education, work, the military, and im.docxChoose two of the systems (education, work, the military, and im.docx
Choose two of the systems (education, work, the military, and im.docxtroutmanboris
 
Choose two disorders from the categories presented this week.C.docx
Choose two disorders from the categories presented this week.C.docxChoose two disorders from the categories presented this week.C.docx
Choose two disorders from the categories presented this week.C.docxtroutmanboris
 
Choose ONE of the following topics Length 750-900 words, .docx
Choose ONE of the following topics Length 750-900 words, .docxChoose ONE of the following topics Length 750-900 words, .docx
Choose ONE of the following topics Length 750-900 words, .docxtroutmanboris
 
Choose one of the following topicsAmerica A Narrative.docx
Choose one of the following topicsAmerica A Narrative.docxChoose one of the following topicsAmerica A Narrative.docx
Choose one of the following topicsAmerica A Narrative.docxtroutmanboris
 
Choose one of the following topics below. Comparecont.docx
Choose one of the following topics below. Comparecont.docxChoose one of the following topics below. Comparecont.docx
Choose one of the following topics below. Comparecont.docxtroutmanboris
 
Choose one of the following topics below. Comparecon.docx
Choose one of the following topics below. Comparecon.docxChoose one of the following topics below. Comparecon.docx
Choose one of the following topics below. Comparecon.docxtroutmanboris
 
Choose one of the states of RacialCultural Identity Development.docx
Choose one of the states of RacialCultural Identity Development.docxChoose one of the states of RacialCultural Identity Development.docx
Choose one of the states of RacialCultural Identity Development.docxtroutmanboris
 
Choose one of the following topicsNative AmericansWomenEnvi.docx
Choose one of the following topicsNative AmericansWomenEnvi.docxChoose one of the following topicsNative AmericansWomenEnvi.docx
Choose one of the following topicsNative AmericansWomenEnvi.docxtroutmanboris
 
Choose one of the following films for review (with faculty’s appro.docx
Choose one of the following films for review (with faculty’s appro.docxChoose one of the following films for review (with faculty’s appro.docx
Choose one of the following films for review (with faculty’s appro.docxtroutmanboris
 
Choose and complete one of the two assignment options.docx
Choose and complete one of the two assignment options.docxChoose and complete one of the two assignment options.docx
Choose and complete one of the two assignment options.docxtroutmanboris
 

More from troutmanboris (20)

Christian Schussele Men of ProgressOil on canvas, 1862Coope.docx
Christian Schussele  Men of ProgressOil on canvas, 1862Coope.docxChristian Schussele  Men of ProgressOil on canvas, 1862Coope.docx
Christian Schussele Men of ProgressOil on canvas, 1862Coope.docx
 
Christian EthicsChristian ethics deeply align with absolutism. E.docx
Christian EthicsChristian ethics deeply align with absolutism. E.docxChristian EthicsChristian ethics deeply align with absolutism. E.docx
Christian EthicsChristian ethics deeply align with absolutism. E.docx
 
Christian Ethics BA 616 Business Ethics Definiti.docx
Christian Ethics BA 616 Business Ethics Definiti.docxChristian Ethics BA 616 Business Ethics Definiti.docx
Christian Ethics BA 616 Business Ethics Definiti.docx
 
CHPSI think you made a really good point that Howard lacks poli.docx
CHPSI think you made a really good point that Howard lacks poli.docxCHPSI think you made a really good point that Howard lacks poli.docx
CHPSI think you made a really good point that Howard lacks poli.docx
 
Chrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docx
Chrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docxChrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docx
Chrétien de Troyes, Lancelot, 1Chrétien de Troyes, Lancelo.docx
 
Chosen brand CHANELStudents are required to research a fash.docx
Chosen brand CHANELStudents are required to research a fash.docxChosen brand CHANELStudents are required to research a fash.docx
Chosen brand CHANELStudents are required to research a fash.docx
 
Chose one person to reply to ALBORES 1. Were Manning’s acti.docx
Chose one person to reply to ALBORES 1. Were Manning’s acti.docxChose one person to reply to ALBORES 1. Were Manning’s acti.docx
Chose one person to reply to ALBORES 1. Were Manning’s acti.docx
 
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docx
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docxChoosing your literary essay topic on Disgrace by J. M. Coetzee .docx
Choosing your literary essay topic on Disgrace by J. M. Coetzee .docx
 
Choosing your Philosophical Question The Final Project is an opp.docx
Choosing your Philosophical Question The Final Project is an opp.docxChoosing your Philosophical Question The Final Project is an opp.docx
Choosing your Philosophical Question The Final Project is an opp.docx
 
Choosing Your Research Method in a NutshellBy James Rice and.docx
Choosing Your Research Method in a NutshellBy James Rice and.docxChoosing Your Research Method in a NutshellBy James Rice and.docx
Choosing Your Research Method in a NutshellBy James Rice and.docx
 
Choose two of the systems (education, work, the military, and im.docx
Choose two of the systems (education, work, the military, and im.docxChoose two of the systems (education, work, the military, and im.docx
Choose two of the systems (education, work, the military, and im.docx
 
Choose two disorders from the categories presented this week.C.docx
Choose two disorders from the categories presented this week.C.docxChoose two disorders from the categories presented this week.C.docx
Choose two disorders from the categories presented this week.C.docx
 
Choose ONE of the following topics Length 750-900 words, .docx
Choose ONE of the following topics Length 750-900 words, .docxChoose ONE of the following topics Length 750-900 words, .docx
Choose ONE of the following topics Length 750-900 words, .docx
 
Choose one of the following topicsAmerica A Narrative.docx
Choose one of the following topicsAmerica A Narrative.docxChoose one of the following topicsAmerica A Narrative.docx
Choose one of the following topicsAmerica A Narrative.docx
 
Choose one of the following topics below. Comparecont.docx
Choose one of the following topics below. Comparecont.docxChoose one of the following topics below. Comparecont.docx
Choose one of the following topics below. Comparecont.docx
 
Choose one of the following topics below. Comparecon.docx
Choose one of the following topics below. Comparecon.docxChoose one of the following topics below. Comparecon.docx
Choose one of the following topics below. Comparecon.docx
 
Choose one of the states of RacialCultural Identity Development.docx
Choose one of the states of RacialCultural Identity Development.docxChoose one of the states of RacialCultural Identity Development.docx
Choose one of the states of RacialCultural Identity Development.docx
 
Choose one of the following topicsNative AmericansWomenEnvi.docx
Choose one of the following topicsNative AmericansWomenEnvi.docxChoose one of the following topicsNative AmericansWomenEnvi.docx
Choose one of the following topicsNative AmericansWomenEnvi.docx
 
Choose one of the following films for review (with faculty’s appro.docx
Choose one of the following films for review (with faculty’s appro.docxChoose one of the following films for review (with faculty’s appro.docx
Choose one of the following films for review (with faculty’s appro.docx
 
Choose and complete one of the two assignment options.docx
Choose and complete one of the two assignment options.docxChoose and complete one of the two assignment options.docx
Choose and complete one of the two assignment options.docx
 

Recently uploaded

The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/siemaillard
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Denish Jangid
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Celine George
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryCeline George
 
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxHVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxKunal10679
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024CapitolTechU
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptxmanishaJyala2
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfMinawBelay
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...Krashi Coaching
 

Recently uploaded (20)

The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxHVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 

#include iostreamusing namespace std;double sumNums(

  • 1. #include <iostream> using namespace std; double sumNums(double num1, double num2); double subNums(double num1, double num2); double multNums(double num1, double num2); double divNums(double num1, double num2); int main() { char op; float num1, num2; cout << "Enter + for addition nEnter - for subtraction nEnter * for multiplication nEnter / for division nEnter O to show previous five operators nEnter E to exit" << endl;
  • 2. cout << "nChoose an option: "; cin >> op; cout << "Enter first number: "; cin >> num1; cout << "Enter the second number: "; cin >> num2; switch(op) { case '+': cout << "" << num1 << " + " << num2 << " = " << sumNums(num1, num2) << endl; break; case '-': cout << "" << num1 << " - " << num2 << " = " << subNums(num1, num2) << endl;
  • 3. break; case '*': cout << "" << num1 << " * " << num2 << " = " << multNums(num1, num2) << endl; break; case '/': cout << "" << num1 << " / " << num2 << " = " << divNums(num1, num2) << endl; break; case 'E': cout << "Thank you"; break; default: cout << "Select a valid menu option" << endl; break; }
  • 4. while(op != 'E') { cout << "nEnter + for addition nEnter - for subtraction nEnter * for multiplication nEnter / for division nEnter O to show previous five operators nEnter E to exit" << endl; cout << "nChoose an option: "; cin >> op; cout << "Enter first number: "; cin >> num1; cout << "Enter the second number: "; cin >> num2; switch(op) { case '+': cout << "" << num1 << " + " << num2 << " = "
  • 5. << sumNums(num1, num2) << endl; break; case '-': cout << "" << num1 << " - " << num2 << " = " << subNums(num1, num2) << endl; break; case '*': cout << "" << num1 << " * " << num2 << " = " << multNums(num1, num2) << endl; break; case '/': cout << "" << num1 << " / " << num2 << " = " << divNums(num1, num2) << endl; break; case 'E': cout << "Thank you"; break; default: cout << "Select a valid menu option" << endl; break;
  • 6. } } return 0; } double sumNums(double num1, double num2) { double sum; sum = 0; sum = num1 + num2; return sum; }
  • 7. double subNums(double num1, double num2) { double dif; dif = 0; dif = num1 - num2; return dif; } double multNums(double num1, double num2) { double prod; prod = 0; prod = num1 * num2; return prod; } double divNums(double num1, double num2)
  • 8. { double quot; quot = 0; quot = num1 / num2; return quot; }