In file i have a text. Words form line to line dont raising. Word in line separate least one space.Spaces can be at line begining and ending, can be empty lines. Count how many words can be in real number.
i need a function whitch can count words whitch can be real number.
I started like that this was first task, and now i need to count words, please help me ;/
const char Cduom[] = "Duomenys.txt";
const char Crez[] = "Rezultatai.txt";
const char Canalize[] = "Analize.txt";
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
void ApdorotiTeksta(const char dfv[], const char rfv[]);
void AnalizuotiEilute(string eil);
int main()
{
ApdorotiTeksta(Cduom, Crez);
}
void ApdorotiTeksta(const char dfv[], const char rfv[])
{
ifstream fd(dfv);
ofstream fr(rfv);
string E;
while(!fd.eof()) {
getline(fd, E);
fr << E << endl;
}
fd.close();
fr.close();
}
void AnalizuotiEilute(string eil )
{
string Zodis;
string Skirt = " ,!?:;()\t";
int zpr = 0, zpb = 0;
while ((zpr = eil.find_first_not_of(Skirt, zpb)) != string::npos) {
zpb = eil.find_first_of(Skirt, zpr);
Zodis = eil.substr(zpr, zpb - zpr);
}
}