Programming.txt
Код: Выделить всё
Ball, Ball, Cat, Dog, Ball,
Код: Выделить всё
#include
#include
#include
#include
using namespace std;
int main()
{
ifstream file("Programming.txt");
if(file.is_open())
{
string line;
int wordcount = 0;
while(getline(file, line))
{
stringstream ss(line);
string word = "Ball";
while(ss >> word)
{
wordcount++;
}
}
file.close();
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79255426/in-my-project-i-have-to-create-a-program-that-reads-a-file-and-counts-the-number[/url]