Cod sursa(job #2367207)
Utilizator | Ramba Teodor Andrei andrei.rram | Data | 5 martie 2019 09:27:39 |
---|---|---|---|
Problema | Text | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
int ct=1,nr=0;
char text[101],z[101];
fin.getline(text,101);
char* cuv;
char sep[3]={" -"};
cuv=strtok(text,sep);
while(cuv!=NULL)
{
strcpy(z,cuv);
nr+=strlen(z);
cuv=strtok(NULL,sep);
ct++;
}
fout<<nr/ct;
}