Cod sursa(job #2219020)

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