Program that asks the user for two integers and a character

Assignment Help C/C++ Programming
Reference no: EM13938487

Write a program that asks the user for two integers and a character, 'A', 'S', or 'M'. Call one of three functions that adds, substracts, or multiplies the user's integers, based on the character input.

This is what I have so far but I cant figure out how to link the character data A, M, or S to the specific funtions.

#include<iostream>

using namespace std;

void main()
{
int a, b;
char c;
int result=0;

cout << " Please enter first integer: ";
cin>> a;

cout << " Please enter second integer: ";
cin>> b;

cout << "nnn(A) Additionnnn(M) Multiplicationnnn(S) SubstractionnnnPlease enter a character input: ";
cin>> c;
while (c!='A' && c!='a' && c!='M' && c!='m' && c!='S' && c!='s')
{
cout<<"Invalid selection.nnYou must enter a valid selection A, M, or S.nn"<<endl;

cout<<"Please enter a character input: ";
cin>>c;
cout<<endl;
}//end while
if (c == 'A' || c == 'a')
{

}
}
int resultAdd(int num1, int num2)
{
int result;
result = num1 + num2;
cout<<"The sum of two integers is: " <<result<<endl;
return result;
}

int resultMult(int num1, int num2)
{
int result;
result = num1 * num2;
cout<<"The multiplication of two integers is: " <<result<<endl;
return result;
}

int resultSub(int num1, int num2)
{
int result;
result = num1 - num2;
cout<<"The difference between two integers is: " <<result<<endl;
return result;
}

Attachment:- twoIntegers.zip

Reference no: EM13938487

Questions Cloud

Depreciation is straight-line to zero over life of projects : We are evaluating a project that costs $1089458, has a seven-year life, and has no salvage value. Assume that depreciation is straight-line to zero over the life of the project. Sales are projected at 40651 units per year. Suppose the projections giv..
Very large and rapid declines in the policy rate : We observe very large and rapid declines in the policy rate (the very short rate) in late 2008 and early 2009. Considering the US, the UK, and Japan, did long rates fall as much around that time or less or more?
Calculate the expected full cost of the surenex engagement : Calculate the expected full cost of the Surenex engagement, including an allocation of overhead.
Represents the second highest overhead : For most organizations, the cost of built space represents the second highest overhead (OpEx) after staff costs. From critical consideration of the relevant research literature, your experience, and best practice in space management, consider the ..
Program that asks the user for two integers and a character : Write a program that asks the user for two integers and a character, 'A', 'S', or 'M'. Call one of three functions that adds, substracts, or multiplies the user's integers, based on the character input.
Research a number of community organisations : You are asked to research a number of community organisations (at least three) and construct a typology which demonstrates: what they do, how they approach management of the various aspects of their operations and how they demonstrate effectivenes..
Differences between channel proteins and carrier proteins : Insulin increases glucose transport across the cell membrane of an adipocyte but not across the membrane of a liver cell. How can one hormone have two different effects?
C program that will fork a new process : Write a C program that will fork a new process. The parent side has to sort the elements of an array of size 10 in ascending order, while the child process has to sort the same array in descending order using bubble sort technique.
How is the amount of a liability measured : How is the amount of a liability measured? When are most liabilities recognized? What are current liabilities? Provide some common examples.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd