Here is my code, I keep getting a " no match for opperator error on my outfile, I have no idea why?
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
int main ()
{
double x[1000],fx,n;
cout<<"What n?"<<endl;
cin>> n;
ifstream infile, outFile;
infile.open ("data7.data");
outFile.open("results7.txt");
for (int i=0;i<1000; i++)
{
infile >> x[i];
//cout<< x[i]<<endl;
for( double b=.05; b<=5; b=b+.01)
{
fx=b*(x[i]-n*log(b));
//cout<< setw(12) << fx << setw(12) << b << endl;
outFile<< setw(12) <<fx << setw(12) << b << endl;
}
//cout << setw(12) << fx << setw(12) << b << endl;
//cout<<-1*fx<<endl;
}
infile.close();
outFile.close();
system("PAUSE");
return(0);
}
Two input files:
ifstream infile, outFile;