Cod sursa(job #997798)

Utilizator katakonst94Pirvu Constantin Catalin katakonst94 Data 14 septembrie 2013 21:37:01
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.76 kb
#include <iostream>
#include<string.h>
#include<fstream>
#include <ctype.h>

using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
char s[10000000];
char k[10000000];
int main()
{
    FILE * pFile;
pFile=fopen("text.out","w");

    int g,r;
    int i,aux,c,p;
    p=0;
    aux=0;
    c=0;



f.read(s, sizeof s);
if (f.eof())
{

    size_t bytes_really_read = f.gcount();

}
int aux2=0;
g=strlen(s);

    for(i=0;i<=g;i++)
    {
       aux=s[i];
       aux2=s[i+1];
        if(aux==' ')
        {
            ++c;
        }
       else if(aux=='-' && aux2!=' ')
        {
            ++c;
        }
        if(isalpha(aux)==0)
{
    ++p;

}

   }

r=(g-p)/c;
fprintf(pFile,"%d",r);
fclose (pFile);

}