Pagini recente » Cod sursa (job #2511568) | Cod sursa (job #2279857) | Cod sursa (job #1390207) | Cod sursa (job #1962497) | Cod sursa (job #1098667)
// 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(sir,tok);
while (q)
{
sum++;
q = strtok(NULL, tok);
}
if (!sum)fout << 0;
else fout << k / sum;
return 0;
}