Cod sursa(job #2134370)
Utilizator | Data | 17 februarie 2018 21:25:01 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <iostream>
#include<stdio.h>
FILE *f,*g;
using namespace std;
int main ()
{
f=fopen("text.in","r");
g=fopen("text.out","w");
char c; int k=0;
fscanf(f,"%c",&c);
long lungimecuvinte=0,nrcuvinte=0,ma;
while (!feof(f)){
if(c>='a'&&c<='z'||c>='A'&&c<='Z')
{
lungimecuvinte++;
if(!k) nrcuvinte++;
k=1;
}
else
k=0;
fscanf(f,"%c",&c);
}
ma=lungimecuvinte/nrcuvinte;
fprintf(g,"%ld",ma);
return 0;
}