Pagini recente » Cod sursa (job #1106839) | Cod sursa (job #1392899) | Cod sursa (job #2269767) | Cod sursa (job #2744650) | Cod sursa (job #2541355)
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;
ifstream fin ("text.in");
ofstream fout("text.out");
char prop[256];
int nrCaract, nrCuv=0;
void citire (char text[4050])
{
fin.getline(text,4050);
}
int strLen=0;
int nrSpatii=0;
int main()
{
char text[4050];
citire(text);
char semnePunctuatie[]=",!?.;";
int nrSemne=0;
nrSemne=strlen(semnePunctuatie);
strLen=strlen(text);
int nrLitere=0;
nrLitere=strLen;
for (int i=1; i<=strLen; i++)
{
if (isspace(text[i]) || text[i]=='-')
{
nrCuv++;
nrLitere--;
}
for (int j=0; j<=nrSemne; j++)
{
if (text[i]==semnePunctuatie[j])
{
nrLitere--;
}
}
}
fout<<nrLitere/nrCuv;
}