#include <iostream>
#include <fstream>
#include <string>
using std::cout;
using std::endl;
using std::string;
int main(void)
{
static const char *fileName = "d:\\data.txt";
std::ifstream ifs(fileName);
if (ifs.is_open()) {
while (ifs.good()) {
string word;
ifs >> word;
cout << word << endl;
}
}
else {
std::cerr << "Error open the file" << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
/*
run:
c
c++
c#
java
c++
php
python
c++
*/