Cod sursa(job #721512)
Utilizator | Satirbasa Andrei andreistb1996 | Data | 23 martie 2012 19:16:15 |
---|---|---|---|
Problema | Text | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<fstream>
#include<cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int nr1,n,i,nr;
char s[1000],v[100][100],*p;
int main()
{f.getline(s,1000);
n=strlen(s)-1;
for(i=1;i<=n;i++)
if(s[i]>='a' && s[i]<='z')
nr1++;
nr=0;
p=strtok(s,". -,?!;");
while(p)
{nr++;
strcpy(v[nr],p);
p=strtok(NULL , ". -,?!;");}
g<<nr1/nr;
f.close();
g.close();
return 0;}