Cod sursa(job #1670872)
Utilizator | Data | 1 aprilie 2016 09:48:12 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int k,l,su;
int main()
{
char *p,s[255];
f.getline(s,255);
p=strtok(s,"-,.;?:! ");
while(p!=0)
{
l=strlen(p);
su=su+l;
k++;
p=strtok(0,"-,.;?:! ");
}
g<<su/k;
return 0;
}