OK, here is my dilemma, I am trying to read an input file into 3 arrays. The file must be formatted as such (ie - with each value on a new row):
3 - n value for an n x n matrix 'a'
1 - a11 - Next n^2 terms are a[j]
2 - a12
3 - a13
4 - a21
5 - a22
6 - a23
7 - a31
8 - a32
9 - a33
1 - y1 - first entry in solution vector of linear problem --> y[j]
2 - y2
3 - y3
The goal of the code is to solve Ax = y for x. I have done this successfully, but I can not get my input to read from a file. So far I have tried doing it step by step, reading the first line as n, the next n^2 as a[j] and the last as y[j]. However, I can't seem to do it without errors, particularly because I am not sure how to convert the input char matrix tempA to a double matrix A for my calculations. Any help would be great!
.........
int n;
char nn;
nn=0;
for (i = 0; i < 1; i++)
{
inputFile >> nn;
}
n=atoi(&nn);
char *tempA;
tempA = 0;
for (i=1; i<=(n^2); i++)
{
inputFile >> tempA[i];
}
char *tempP;
tempP = 0;
for (i=n^2; i<=(n^2+n); i++)
{
inputFile >> tempP[i];
}
inputFile.close();