Cod sursa(job #2219022)

Utilizator laurentiu21Laurentiu Cretu laurentiu21 Data 6 iulie 2018 20:33:00
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
    char text[10000],sep[]=",.?! ",*p;
    unsigned int n=0,k=0,i,x;
    f.get(text,9999);
    x=strlen(text);
    for (i=0; i<x; i++)
        if ((text[i]>='a' && text[i]<='z') || (text[i]>='A' && text[i]<='Z'))
           k++;
    p=strtok(text,sep);
    while (p)
    {
        n++;
        p=strtok(NULL,sep);
    }
    g<<(int)k/n;
    return 0;
}