Pagini recente » Cod sursa (job #1999367) | Cod sursa (job #1754938) | Cod sursa (job #2330812) | Cod sursa (job #471152) | Cod sursa (job #1514354)
#include <stdio.h>
using namespace std;
int main()
{
int OK=0,length = 0,nr=0;
char character;
FILE * f= fopen("text.in","r");
FILE *g = fopen("text.out","w");
//fstream f("text.in");
//ofstream g("text.out");
while(fscanf(f,"%c",&character)>0){
// while(!f.eof()){
//f.get(character);
if((character>='a' && character<='z') || (character>='A' && character<='Z')){
OK = 1;
length++;
}
else if((OK==1)){
nr++;
OK = 0;
}
}
///g<<length/nr;
fprintf(g,"%d",length/nr);
return 0;
}