Cod sursa(job #1419514)

Utilizator valivalica99ThisNameIsPerfect valivalica99 Data 15 aprilie 2015 20:39:12
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
using namespace std;
char c,v[1000];
int nr,l,i,n,a,b,k;
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    while (f.get(c))
    {
        n++;
        v[n]=c;
        if ((((c>=97) and (c<=122)) or ((c>=65) and (c<=90))) and (k==0)) {a=n;k=1;}
        else if ((((c>=97) and (c<=122)) or ((c>=65) and (c<=90))) and (k==1)) b=n;
    }
    for (i=a;i<=b;i++)
    {
         if (((v[i]>=97) and (v[i]<=122)) or ((v[i]>=65) and (v[i]<=90))) l++;
         else nr++;
    }
    g<<l/nr;
    return 0;
}