Cod sursa(job #711617)
| Utilizator | Data | 12 martie 2012 14:55:24 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
FILE *f=fopen("text.in", "r");
ofstream g("text.out");
char c[1000], s[13]="\n;:-_.,/!? ", s2[4]="\n ", *r;
int sum=0, nc=0;
fgets(c, 100, f);
r=strtok(c, s);
while(r!=NULL)
{
sum+=strlen(r);
nc++;
r=strtok(NULL, s);
}
g<<sum/nc;
return 0;
}
