Cod sursa(job #758545)

Utilizator graresGrozescu Rares Ionut grares Data 15 iunie 2012 22:41:16
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#include<iostream>
#include<string.h>
#include<fstream>

using namespace std;

int main()
{
    char a[100];
    int i,m,n;
    bool ok;
    fstream f("text.in",ios::in);
    fstream g("text.out",ios::out);
    f.get(a,100);
    i=1;
    m=n=0;
    while(a[i]!='!'|| a[i]!='.'|| a[i]!='?')
    {
        if(a[i]!='-'||a[i]!=' '||a[i]!=',')
        {
            m++;//lungime cuvinte
            ok=0;
        }
        else
        {
            ok=1;
            if(ok==1)
            {
                n++;//numar cuvinte
                ok++;
            }
        }

    }
    g<<m/n;
    f.close();
    g.close();
}