Pagini recente » Cod sursa (job #2266058) | Cod sursa (job #1215179) | Cod sursa (job #458142) | Cod sursa (job #1622096) | Cod sursa (job #272749)
Cod sursa(job #272749)
#include <iostream.h>
#include <string.h>
#include <fstream.h>
fstream f("text.in",ios::in);
fstream g("text.out",ios::out);
char a[1000];
int k,l,n,i,j,m,ok;
int main ()
{
f.get(a,1000);f.get();
n=strlen(a);
m=n;
if (a[0]=='-') {
i=1;
m--;
}
ok=0;
while (m!=0)
{
i++;
if (a[i]>='a' && a[i]<='z' || a[i]>='A' && a[i]<='Z') {
k++;
ok=1;
}
else if (ok==1) {
l++;
ok=1;
}
m--;
}
if (a[n-1]>='A' && a[n-1]<='Z' || a[n-1]>='a' && a[n-1]<='z') l++;
g<<k/l;
f.close();
g.close();
return 0;
}