Hello Everyone I am a bit stuck on this program, if you can offer some insight to what may be wrong or any tips to get my code in working order I will appreciated and thank you in advance.
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{
ifstream infile;
infile.open("math.txt");
if(infile.fail()){
cout<<"error!"<<endl;
}
int x, y;
char op;
So what's the problem? Well the output "error!" means the file could not be opened. Usually that is because it is in the wrong folder or directory. Try placing "math.txt" either in the same location as the executable (.exe on windows) or as the source code .cpp (depending on which IDE is used and how the program is run).