Cod sursa(job #1162834)

Utilizator tudormaximTudor Maxim tudormaxim Data 31 martie 2014 23:54:21
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <fstream>
using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
int i,k,c,sw;
char s,ch;
int main()
{
    while (f.get(s))
    {
        if ((s>='A'&&s<='Z')||(s>='a'&&s<='z')) k++;
        else if ((ch>='A'&&ch<='Z')||(ch>='a'&&ch<='z')) c++;
        ch=s;
    }
    if ((s>='A'&&s<='Z')||(s>='a'&&s<='z'))
        c++;
    if (c!=0)
        g<<k/c;
    else g<<0;

    return 0;
}