Cod sursa(job #523337)

Utilizator MercurifyPaul Calescu Mercurify Data 17 ianuarie 2011 20:23:13
Problema Text Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include<iostream.h>
#include<fstream.h>
ifstream f("text.in");
ofstream g("text.out");
int main(){
	char x;
	int i=0,nr=0,s=0,ok=0;
	f>>x;
	while(f.peek()!=EOF){
		if(ok==0){
			while((x<'a'||x>'z')&&(x<'A'||x>'Z')){
				x=f.get();
			}
			ok=1;
		}
		else{
			nr++;
			while((x>='a'&&x<='z')||(x>='A'&&x<='Z')){
				s++;
				x=f.get();
			}
			ok=0;
		}
	}
	g<<s/nr;
	f.close();
	g.close();
	return 0;
	}