Cod sursa(job #640135)
| Utilizator | Data | 24 noiembrie 2011 20:28:54 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <iostream>
#include <fstream>
using namespace std;
int suma,nrc;
char d[100][100];
char s[1000];
char *p;
ifstream fin("text.in");
ofstream fout("text.out");
void citire ()
{
fin.getline(s,1000);
}
void punere ()
{
p=strtok(s,".,!? ");
while(p)
{
strcpy(d[nrc++],p);
p=strtok(NULL,".,!? ");
}
}
int parc ()
{
for (int i=0;i<nrc;i++)
suma+=strlen(d[i]);
return suma;
}
int main()
{
int ma;
citire ();
punere ();
ma=parc()/nrc;
fout<<ma;
return 0;
}
