Cod sursa(job #997216)

Utilizator ciobu69Ciobanu Sergiu ciobu69 Data 13 septembrie 2013 15:52:08
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char a, b;
int s, nr;
int main()
{
	f.get(a);
	 if ((a>='A' && a<='Z') || (a>='a' && a<='z'))
        s++;
    while(f.get(b))
    {
        if((b>='A' && b<='Z' ) || (b>='a' && b<='z') )
            s++;
        else
            if((a>='A' && a<='Z') || ( a>='a' && a<='z')) 
                nr++;
        a=b;
    }
    if((b>='A' && b<='Z') || ( b>='a' && b<='z') ) nr++;
    g<<s/nr; g.close();
    return 0;
}