Cod sursa(job #599504)

Utilizator DanytzuBran Daniel Danytzu Data 28 iunie 2011 22:47:33
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<stdio.h>
#include <iostream>
using namespace std;
 
int main()
{
char c;
int ok=0,litere=0,cuvinte=0;

FILE *f, *g;
f = fopen("text.in", "rt");
g = fopen("text.out", "wt");
 
while(c=fgetc(f))
{
if((c>='a' && c<='z') || (c>='A' && c<='Z'))
{
litere++;
if(!ok)
{
cuvinte++;
ok=1;
}
}
else
{
ok = 0;
if(c == EOF) break;
}
}
fprintf(g, "%i",litere/cuvinte);
return 0;
}