Cod sursa(job #23111)

Utilizator zepusSpuze Cristian-Iulius zepus Data 28 februarie 2007 09:28:55
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <fstream.h>
#include <string.h>
int main()
  {
   char x[256];
   long b=0,a=0,i,max;
   ifstream f("text.in");
   ofstream g("text.out");
   f.get(x,256);
   max=strlen(x);
   i=0;
   while (i<=max)
     {
      while ((x[i]==' ' || x[i]=='-' || x[i]==',' || x[i]=='!' || x[i]=='.' || x[i]=='?' || x[i]==';') && i<=max)
	 i++;
      while(x[i]!=' ' && x[i]!='-' && x[i]!=',' && x[i]!='!' && x[i]!='.' && x[i]!='?' && x[i]!=';' && i<=max)
	{
	 i++;
	 a++;
	}
      b++;
     }

   b--;a--;
   g<<a<<" "<<b<<" "<<a/b;
   f.close();
   g.close();
   return 0;
  }