Pagini recente » Cod sursa (job #118279) | Cod sursa (job #945439) | Cod sursa (job #2586155) | Cod sursa (job #952789) | Cod sursa (job #93470)
Cod sursa(job #93470)
#include <fstream.h>
#include <string.h>
#include <iomanip.h>
ifstream fin("text.in");
ofstream fout("text.out");
int str_len(char text[])
{
int c=0, i;
int s;
s = strlen(text);
for (i=0; i < s; i++)
if (text[i]>='a' && text[i]<='z' || text[i]>='A' && text[i]<='Z') c++;
return c;
}
int cuvinte (char text[])
{
int cuv = 0;
int s;
s = strlen(text);
for (int i=0; i < s; i++)
if (text[i] == ' ') cuv++;
return cuv;
}
int main()
{
char text[200];
int l, cuv, t;
int i=0;
while (!fin.eof())
{
fin>>resetiosflags(ios::skipws)>>text[i];
i++;
}
l = str_len(text);
cuv = cuvinte(text)+1;
t = l/cuv;
fout<<t<<endl;
return 0;
}