Hello. Inside a for loop I need to read in five numbers from five columns in the current row. Can someone please direct me to documentation to do this using only #include <iostream>, #include <iomanip>, #include <stdlib.h>. No Vectors. No Arrays. Just simple redirection for input/output from a .txt file. Thanks
//reads one row
for (int i = 0; i < 5; i ++)
{
int n;
f >> n;
std::cout << n << std::endl;
}
I feel like the tutorial on this site should give a basic code example of this, I'm surprised it doesn't, although it does say that the stream operators can be used just like std::cout and std::cin. http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/
The direction is intuitive because it's like information is being transferred from the file f to the variable.