hi, i am pretty new at using c++. i am trying to read a mathematical expression from a file but i keep getting errors. i am using the cin.get function to read it but it isnt working. can anyone help me please. this is what i have. the file being read contains
3+4. i am trying to read it in and execute it.
#include<iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream infile;
ofstream outfile;
char sign;
int answer,num1,num2;
infile.open("math.txt");
outfile.open("output.txt");
if (!infile)
cout<<"Could Not Open File"<<endl;
else
{
while(!infile.eof())
{
infile.ignore();
infile.get(num1);
infile.get(sign);
infile.get(num2);
num1 sign num2 = answer;
outfile<<num1<<sign<<num2<<"="<<answer<<endl;
}
}