Cod sursa(job #805779)

Utilizator alexandraleuAlexandra Leulescu alexandraleu Data 1 noiembrie 2012 09:22:09
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<iostream>
#include<string.h>
#include<fstream>   
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
	char text[100],*p,sep[]=" ?.!-";
	int lungime=0,nrcuv=0,i=0;
	f.get(text,100);
	p=text;
	while (*p)
	{
		for(i=0;i<=strlen(sep);i++)
			if(*p==sep[i])
				nrcuv++;
		if((int(*p)>64&&int(*p)<91)||(int(*p)>96&&int(*p)<127))
			lungime++;
		p++;
	}
	g<<lungime/nrcuv;
	f.close();
	return 0;
}