Cod sursa(job #672758)

Utilizator Xavierpana emil Xavier Data 3 februarie 2012 01:25:11
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include<iostream>
#include<fstream>
#include<string>
using namespace std;

ifstream ifile;
ofstream ofile;
int i,v,ok=0;
int c=0,k=0;
string s;

int main(){
    ifile.open("text.in");
    ofile.open("text.out");

    getline(ifile,s);
    
    for(i=0;i<s.length();i++){
          v = (int)s[i];
          if((v>=65 && v<=90) || (v>=97 && v<=122)){ c++; if(!ok){ ok = 1; k++; }}
          else { ok = 0; }
    }
    
    ofile<<c/k; //media
    
    ifile.close();
    ofile.close();
    return 0;
}