Cod sursa(job #2118878)

Utilizator math4Bornea Andrei Laurentiu math4 Data 31 ianuarie 2018 10:43:58
Problema Text Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include<fstream>
#include<string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
long i,nr,nr1;
char a[1000000],b[1000000];
int main()
{
    nr=0;
    nr1=0;
while(!f.eof())
{
f.getline(a,1000000);
if(isalpha(a[0])!=0)
   {
strcpy(b," ");
strcat(b,a);
strcpy(a,b);
   }
for(i=1;i<strlen(a);i++)
{
if((isalpha(a[i])!=0) && (isalpha(a[i-1])==0)) nr++;
if(isalpha(a[i])!=0) nr1++;
}
}
if(nr!=0) g<<nr1/nr;
else g<<"0";
f.close();
g.close();
return 0;
}