Pagini recente » Cod sursa (job #2176109) | Cod sursa (job #1859685) | Cod sursa (job #2860447) | Cod sursa (job #2581811) | Cod sursa (job #898868)
Cod sursa(job #898868)
#include<stdio.h>
using namespace std;
FILE *f=fopen("text.in","r"),
*g=fopen("text.out","w");
char l1,l2;
int nr1,nr;
int main()
{
fscanf(f,"%c",&l1);
while(fscanf(f,"%c",&l2)!=EOF){
if(l2>='a'&&l2<='z'||l2>='0'&&l2<='9'){
nr1++;
}
else{
nr++;
while(!(l1>='a'&&l1<='z'||l1>='0'&&l1<='9')){
if(fscanf(f,"%c",&l1)==EOF)
break;
}
nr1++;
}
}
fprintf(g,"%d",nr1/nr);
return 0;
}