Pagini recente » Cod sursa (job #2837902) | Cod sursa (job #2557041) | Cod sursa (job #1094937) | Cod sursa (job #3154616) | Cod sursa (job #2541420)
#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;
nrLitere=strLen;
int nrCuv=0;
for (int i=0; i<=strLen; i++)
{
if (isspace(text[i]) || text[i]=='-' && i>0 )
{
nrCuv++;
nrLitere--;
}
for (int j=0; j<=nrSemne; j++)
{
if (text[i]==semnePunctuatie[j])
{
nrLitere--;
}
}
}
if (nrCuv==0 || text[0]!='-')
{
nrCuv++;
nrLitere++;
fout<<nrLitere/nrCuv;
}
else
{
fout<<nrLitere/nrCuv;
}
}