Cod sursa(job #178176)

Utilizator zepusSpuze Cristian-Iulius zepus Data 14 aprilie 2008 10:32:14
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <fstream.h>
int main()
  {
   long n=0,m=0,k=0;
   char x;
   ifstream f("text.in");
   ofstream g("text.out");
   while (f.get(x))
     {
      k=0;
      while (x!='.' && x!=',' && x!='-' && x!='?' && x!='!' && x!=' ')
	{
	 if (x=='\n')
	   break;
	 n++;
	 f.get(x);
	 k++;
	}
      if (k!=0)
	m++;
     }
   g<<n<<" "<<m<<"  "<<n/m;
   f.close();
   g.close();
   return 0;
  }