Cod sursa(job #1028257)
Utilizator | buzatu marin razvan buzaturazvan | Data | 13 noiembrie 2013 20:17:21 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include<string.h>
using namespace std;
int main()
{
ifstream f1("text.in");
int i=0,s=0;
char ch;
while(!f1.eof())
{
f1.get(ch);
if( ((ch >= 'a' ) && (ch <= 'z' )) || ((ch >= 'A' ) && (ch <= 'Z')))
i++;
if( ch == ' ')
s++;
if( ch == '-')
s++;
}
ofstream f2("text.out");
f2<<i/s;
}