Cod sursa(job #2232494)
| Utilizator | Data | 19 august 2018 17:46:02 | |
|---|---|---|---|
| Problema | Text | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.61 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[10000];
bool litera(char c)
{
if(( int(c) >= 'a' && int(c) <= 'z') || (int(c) >= 'A' && int(c) <= 'Z')) return true;
return false;
}
int main()
{
int i=0;
int nrL = 0;
int nrC = 0;
bool k = false;
while(f.get(text[i]))
{
if(litera(text[i]))
{
nrL++;
k = 1;
}
else
{
if(k) nrC++;
k=0;
}
i++;
}
g << nrL/nrC;
return 0;
}
