Cod sursa(job #671008)
Utilizator | Cojocaru Cristian kristy2895 | Data | 30 ianuarie 2012 15:56:14 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
int main()
{char SIR[256], *P, SEP[]=" ,?!-";
int A=0 ,B=0;
ifstream F("text.in",ios::in);
ofstream G("text.out",ios::out);
F.getline(SIR,256);
P=strtok(SIR,SEP);
while(P)
{B++;
A=A+strlen(P);
P=strtok(NULL,SEP);
}
G<<A/B;
F.close();
G.close();
return 0;
}