Cod sursa(job #1108694)

Utilizator Razvy16Farte Razvan Dan Razvy16 Data 15 februarie 2014 23:06:42
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;

int main()
{int ok=0,k=0,i;
char s[100];
   ifstream f("text.in");
   ofstream g("text.out");
  while(f>>s)
  {ok++;
  if(!((s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z')))
        ok--;
    else
    for(i=0;i<strlen(s);i++)
       {if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
        k++;
        else
         ok++;}
    }
    g<<k/ok;

    return 0;
}