Cod sursa(job #1090392)

Utilizator arminvandexteragent47 arminvandexter Data 22 ianuarie 2014 17:44:10
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{char s[400],i,*p;
int n=0,m=0;
f.getline(s,400);
p=strtok(s," ");
while(p!=NULL)
{n=n+1;
	for(i=0;i<=strlen(p);i++)
	{if('a'<=p[i] && p[i]>='z' || 'A'<=p[i] && p[i]>='Z')
	m=m+1;
	if(p[i]=='-' && p[i-1]!=' ' && p[i+1]==' ')
	n=n+1;}
	p=strtok(NULL," ");
}
g<<(int)(m/n);
f.close();
g.close();
}