Cod sursa(job #1562082)
Utilizator | Data | 4 ianuarie 2016 19:45:07 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int main()
{
char s[500],cuv[250][250],sep[]=",.-!? ",*p;
int n=0,i,k=0;
ifstream f("text.in");
ofstream g("text.out");
f.get(s,500);
f.get();
f.close();
p=strtok(s,sep);
while (p)
{
strcpy(cuv[n],p);
n++;
p=strtok(NULL,sep);
}
for (i=0;i<n;i++)
k+=strlen(cuv[i]);
g<<k/n;
g.close();
return 0;
}