Cod sursa(job #2810608)

Utilizator lysusLysander Pitu lysus Data 29 noiembrie 2021 20:02:05
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include<fstream>
#include <string.h>
#include <ctype.h>
using namespace std;
 
int main()
{
    char a[101], *p,sep[]=" -";
    int i=0;
    ifstream f("text.in");
    ofstream g("text.out");
    f.get(a,101);
 
    int nrl=0,nrc=0;
 
    for (i=0; i<strlen(a); i++)
        if(isalpha(a[i]))
            nrl++;
 
    p=strtok(a,sep);
    while (p!=NULL)
    {
        nrc++;
        p=strtok(NULL,sep);
    }
    g << nrl/nrc;
 
    f.close();
    g.close();
}