Cod sursa(job #1131099)
Utilizator | Data | 28 februarie 2014 17:48:37 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <fstream>
#include <cstdio>
#include <cstring>
using namespace std;
FILE *f=fopen("text.in","r+");
ofstream g("text.out");
int main()
{
short k=0,L=0;
char sir[255],*p,sep[]=" , - ! . ";
p=new char[255];
fgets(sir,254,f);
p=strtok(sir,sep);
while(p!=NULL)
{
L+=strlen(p);
k++;
p=strtok(NULL,sep);
}
g<<L/k;
g<<'\n';
return 0;
}