Pagini recente » Cod sursa (job #1838837) | Cod sursa (job #2837150) | Cod sursa (job #2450545) | Cod sursa (job #3120948) | Cod sursa (job #260848)
Cod sursa(job #260848)
// Text.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,c=0,d=0;
bool s=false,a;
char character,p=0;
FILE *f1,*f2;
f1=fopen("text.in","r");
f2=fopen("text.out","w");
do
{
fscanf(f1,"%c",&character);
a=s;
s=false;
if(character<=90)
if(character>=65)
{
c++;
s=true;
}
if(character>=97)
if(character<=122)
{
c++;
s=true;
}
if(s==false && a==true)
d++;
if(character==p)
{
if(s==true)
d++;
break;
}
p=character;
}
while(character!='EOF' || character!=0 );
fprintf(f2,"%d",c/d);
fclose(f1);
fclose(f2);
return 0;
}