Pagini recente » Cod sursa (job #421602) | Cod sursa (job #3234091) | Cod sursa (job #3254588) | Cod sursa (job #1439847) | Cod sursa (job #118286)
Cod sursa(job #118286)
#include<fstream.h>
#include<string.h>
#include<ctype.h>
int i,x=0,z=0,t=0;
char sir[256];
int main()
{ifstream f("text.in");
ofstream g("text.out");
f.get(sir,256);
for(i=0;i<strlen(sir);i++)
{if(isdigit(sir[i])) x++;
if(isalpha(sir[i])) x++;}
for(i=0;i<strlen(sir);i++)
{if(isdigit(sir[i])!=0||isalpha(sir[i])!=0)
z++;
else if(z!=0) {t++;z=0;}}
if(x!=0&&t!=0)
g<<int(x/t);
f.close();
g.close();
return 0;}