Hello everyone, I need help figuring out how to make a switch construct that reads the first character from my input file and from there calculates the result.Either add or multiply. I have already completed the entire program it just does not run correctly. It also keeps coming up with error C2681.
Here is the program:
#include "stdafx.h"
#include <iostream>
#include <math.h>
#include "Calcs.h"
#include <iomanip>
#include <fstream>
using std::ifstream;
using std::ofstream;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Calcs myCalcs;
myCalcs.x=7;
{
cerr << "Error: Input file could not be opened" << endl;
exit(1);
}
if(!outFile)
{ cerr << "Error: Output file could not be opened" << endl;
exit(1);
}
while ( !inFile.eof() )
{
inFile >> myCalcs.add(), myCalcs.multiply();
result = myCalcs.add(),myCalcs.multiply();
outFile <<endl;
}
cout << "End-of-file reached.." << endl;
inFile.close();
outFile.close();
int main(void);
{
cout<<"Welcome, this is a calculator."<<std::endl;
cout<<"Please choose an option by entering the number.\n"<<std::endl;
cout<<"1 - Addition of two numbers\n";
cout<<"2 - Multiplication of two numbers\n";
cout<<"3 - Quit\n";
char response= ' ';
cin>>response;