I'm trying to make a 3 by 3 array from information in a .txt file. Inside the .txt file is
0 0 1
0 1 0
1 0 0
I just dont know how to set my integer num as a proper value from the file. I put stars around that below. Thank you.
Your << is going the wrong way. It should be infile >> num; (just like cin is cin >> num, for example). It's putting input into the variable, so the arrows go into the variable. Also, your outer for loop will only iterate twice; i needs to be initialized to 0, not 1. As a sidenote, you don't really need num at all; you can just put the numbers straight into the array.