Cod sursa(job #1504600)
| Utilizator | Data | 17 octombrie 2015 22:31:16 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
char mystring[30000]="";
int numara()
{
int c=0,r,cif=0;
char *pch;
pch=strtok(mystring," ,.!?-");
while (pch)
{
c++;
cif=cif+strlen(pch);
pch=strtok(NULL," ,.!?-");
}
r=cif/c;
return r;
}
int main()
{
ifstream infile("text.in");
ofstream out("text.out");
string line;
while (getline(infile, line))
strcat(mystring,line.c_str());
out<<numara();
}
