Pagini recente » Cod sursa (job #3000446) | Cod sursa (job #476510) | Cod sursa (job #3124500) | Cod sursa (job #939456) | Cod sursa (job #260883)
Cod sursa(job #260883)
// 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,l=0,ver=2;
bool s=false,a;
char character,p=0;
FILE *f1,*f2;
f1=fopen("text.in","r");
f2=fopen("text.out","w");
do
{
ver=fscanf(f1,"%c",&character);
if(ver<0)
break;
a=s;
s=false;
if(character<=90)
if(character>=65)
{
c++;
s=true;
}
if(character>=97)
if(character<=122)
{
c++;
s=true;
}
if(s==true && a==false)
d++;
p=character;
}
while(character!='EOF' || character!=0 );
fprintf(f2,"%d",c/d);
fclose(f1);
fclose(f2);
return 0;
}