[Solved] Accessing data in a text file [closed]
Simply: #include <fstream> #include <iostream> int main() { std::fstream file(“table1.txt”); std::string word; while (file >> word) { // do whatever you want, e.g. print: std::cout << word << std::endl; } file.close(); return 0; } word variable will contain every single word from a text file (words should be separated by space in your file). 1 … Read more