fork download
  1. #include <fstream>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <vector>
  5. #include <string>
  6.  
  7. int main() {
  8. //load file into vector of strings named words
  9. typedef std::istream_iterator<std::string> iiter;
  10. std::ifstream dict("dictionary.txt");
  11. std::vector<std::string> words = std::vector<std::string>(iiter(dict), iiter());
  12.  
  13. //print words
  14. for(int i=0; i<words.size(); ++i)
  15. std::cout << words[i] << '\n';
  16. }
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
Standard output is empty