Pagini recente » Cod sursa (job #33666) | Cod sursa (job #2186587) | Cod sursa (job #1057116) | Cod sursa (job #2948725) | Cod sursa (job #2219020)
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char text[10000],*p;
int n=0,k=0,i;
f.get(text,9999);
for (i=0; i<strlen(text); i++)
if (text[i]>='a' && text[i]<='z' || text[i]>='A' && text[i]<='Z')
k++;
p=strtok(text," ");
while (p)
{
n++;
p=strtok(NULL," ");
}
g<<(int)k/n;
return 0;
}