Pagini recente » Cod sursa (job #2500557) | Cod sursa (job #2881301) | Cod sursa (job #1721927) | Cod sursa (job #2888901) | Cod sursa (job #326466)
Cod sursa(job #326466)
#include<stdio.h>
using namespace std;
int main()
{
FILE *f=fopen("text.in","r"), *g=fopen("text.out","w");
int cuvinte=0,ok=0,cuv=1,a;
char c;
//fscanf(f,"%c", &c);
//if( ( ( (int) c < 65 ) || ( (int)c > 122 ) ) || ( ( (int) c < 97) || ( (int) c > 122 ) ) )
while(fscanf(f,"%c", &c)!=EOF)
{ //scanf("%c", &c);
if( ( ( (int) c < 65 ) || ( (int)c > 90 ) ) && ( ( (int) c < 97) || ( (int) c > 122 ) ) )
{
if(ok==1)
cuvinte++;
ok=0;
}
else {ok=1;cuv++;}
}
//if(cuvinte==0)
// a=0;
//else
a=cuv/cuvinte;
fprintf(g,"%d\n",a);
fclose(f);
fclose(g);
return 0;}