Cod sursa(job #1561868)

Utilizator dragomirmanuelDragomir Manuel dragomirmanuel Data 4 ianuarie 2016 17:11:46
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <iostream>
#include <cstring>
#include <cctype>
#include <fstream>

using namespace std;

int main()
{ char s[100], *p;
    int nr=0, k=0, r, sh=0;
    ifstream f("text.in");
    ofstream g("text.out");
    f.get(s,100);
    r=strlen(s);

    for (p=s;*p;p++) if(isalpha(*p)) nr++;

    for (p=strtok(s," ");p;p=strtok(NULL," ")) sh++;

    g<<nr/sh;

    return 0;
}