Cod sursa(job #1593159)
| Utilizator | Data | 8 februarie 2016 12:57:11 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main(){
char text[100],separator[]=" -,.?!",*p,cuv[100][100];
int nr=0,l=0;
f.get(text,100);
p=strtok(text,separator);
while(p){
strcpy(cuv[nr],p);
l=l+strlen(cuv[nr]);
nr++;
p=strtok(NULL,separator);
}
g<<l/nr;
f.close();
g.close();
return 0;
}
