Cod sursa(job #2541355)

Utilizator VladMariusStana Marius Vlad VladMarius Data 8 februarie 2020 12:49:21
Problema Text Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.89 kb
#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;

}