Pagini recente » Cod sursa (job #3170552) | Cod sursa (job #2012454) | Cod sursa (job #611856) | Cod sursa (job #1714049) | Cod sursa (job #326464)
Cod sursa(job #326464)
#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;}