//Author: //Purpose: Finish this program so that it uses the following // two fu
ID: 3559022 • Letter: #
Question
//Author:
//Purpose: Finish this program so that it uses the following
// two functions:
// readVals - a void function that uses cin to read two
// numbers and a char which main will need
// calcVal - an int function that will return the sum
// of the two numbers if the char is an 'A'
// otherwise if the char is an 'S' the
// function will subtract the smaller from
// the larger number and return the answer
#include <iostream>
#include <iomanip>
using namespace std;
//function prototypes
int main()
{
int x;
int y;
char ch1;
int ans;
cout << "Please enter 2 integers and then 'A' if you want to add them, 'S' if you want to subtract." << endl;
//read in the two numbers and the character using readVals
//calculate the answer using calcVal
//print the answer
cout << "The answer is " << ans << endl;
return 0;
}
//function readVals
//function calcVal
Explanation / Answer
C++ Code:
#include <iostream>
using namespace std;
//readVals - a void function that uses cin to read two
//numbers and a char which main will need
void readVals(int &,int &, char &);
//calcVal - an int function that will return the sum
//of the two numbers if the char is an
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.