Hello,
For my class we are doing a hotplate lab. The part I am having trouble with is reading in a file called Inputplate.txt, and using the information in that file to update my current array. Here is what the specs of the lab say to do.
Part 5 - Input Plate
Input into your plate array from the file "Inputplate.txt" which you should have in the same directory as "Hotplate.csv" in VS. For zyBooks we have already uploaded a file "Inputplate.txt" which you can open and read from. Fill ALL elements of your array from this file including the borders, (though the borders will continue to have the same static values as before). After inputting the initial array, iterate just 3 times with your plate update loop, and then output the current plate values to the screen. These will be the array values after exactly 3 update iterations. You may assume that the input file has only doubles and correctly matches the 10x10 array, thus you will not need to error check your file input. Note that regardless of initial temperatures in the interior, if you have the same steady edge temperatures, and if you run until stable, this plate would have the same stable values (within .1 degrees) as the stable plate above. You might want to try it. Download the contents of the input file here and put a copy in your VS Hot Plate directory with the name "Inputplate.txt".
So far for my code I have been able to input the Inputplate.txt file, and I've tried to create a for loop in my int main that iterates 3 times. However when I output my new array with the input from the Inputplate.txt, I have random garbage that comes out. I am what I am doing wrong in my code.
The code you have above runs and gives a plausible answer.
So your problem almost certainly stems from your ReadFile() routine ...
... which is the one bit of code you haven't included!!!
With this input routine that you presumably have somewhere:
(a) check (from the state of the stream) whether the file can be found and is actually open;
(b) print out the matrix immediately after reading it; then you can identify whether you have read everything correctly before applying your Jacobi algorithm.