I am trying to read a file into an array and set the min and max values. At this point in my program, I am trying to just read it into an array and then display that array. I still have more to do in the program, but I am just tyring to make sure that I am at least reading the array correct. This is what I have so far, any guidance would be helpful!
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
// variables
string filename;
ifstream input;
double angle, coeff;
//prompt user for file
cout << "Enter input file name: ";
cin >> filename;
// Open file and read the first data point.
input.open(filename.c_str());
// will the file open? send an error if it doesn't open
if(!input)
{
cout << "Error opening input file\n";
}
else
{
// reading data entries
input >> angle >> coeff;
}
for(int i = 0; i < angle; i++)
{
for(int j = 0; j < coeff; j++ )
{
cin >> input[i][j];
cout << input[i][j];
}
}
system ("pause");
return 0;
}