Cod sursa(job #1326469)

Utilizator tidehyonBosoi Bogdan tidehyon Data 25 ianuarie 2015 14:56:21
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
    char st[100];
    int nrcuv=0,nrc=0;
    f.get(st,100);
    for(int i=1;i<=strlen(st);i++)
    {
        if(((st[i]==' ')||(st[i]==45))&&((((st[i-1]>=65)&&(st[i-1]<=90))||((st[i-1]>=97)&&(st[i-1]<=122)))||(((st[i+1]>=65)&&(st[i+1]<=90))||((st[i+1]>=97)&&(st[i+1]<=122)))))
            nrcuv++;
    if(((st[i]>=65)&&(st[i]<=90))||((st[i]>=97)&&(st[i]<=122)))
        nrc++;
    }
    cout << nrc << " " << nrcuv;
        f.close();
    g << nrc/nrcuv;
    g.close();
    return 0;
}