Answers for "read each word of text in file c++"

C++
0

how to get a word from file c++

void readFile()
{
    ifstream file;
    file.open ("program.txt");
    if (!file.is_open()) return;

    string word;
    while (file >> word)
    {
        cout<< word << 'n';
    }
}
Posted by: Guest on June-16-2021

Browse Popular Code Answers by Language