Cod sursa(job #911662)

Utilizator apopeid13Apopeid Alejandro apopeid13 Data 11 martie 2013 20:15:13
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream> 
#include<cstring>
using namespace std; 
ifstream f("text.in"); ofstream g("text.out"); 
int n,nrc,l; 
char s; 
inline int cifra(int x) 
{   if('a'<=x && x<='z' || 'A'<=x && x<='Z') return 1; 
    return 0; 
} 
int main() 
{   while(f.get(s)) 
    {   if(!cifra(s) && n) {nrc++; n=0;} 
        if(cifra(s)) {l++; n=1;} 
    }
    if(!nrc) nrc=1;
    g<<l/nrc; g.close(); return 0; 
}