Pagini recente » Cod sursa (job #937876) | Cod sursa (job #2302808) | Cod sursa (job #593348) | Cod sursa (job #3032544) | Cod sursa (job #1098664)
// text.in.cpp : Defines the entry point for the console application.
//
#include<fstream>
#include<string.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char sir[256], *tok = " ,.:;!?-",*q, *b;
int sum, k,i;
int litera(char s)
{
if (('a' <= s&&s <= 'z') || ('A' <= s&&s <= 'Z'))
return 1;
return 0;
}
int main()
{
fin.get(sir, 255);
for (i = 0; sir[i];i++)
if (litera(sir[i]))
k++;
q = strtok_s(sir,tok,&b);
while (q)
{
sum++;
q = strtok_s(NULL, tok, &b);
}
fout << k / sum;
return 0;
}