Nu aveti permisiuni pentru a descarca fisierul grader_test1.in
Cod sursa(job #1113424)
| Utilizator | Data | 20 februarie 2014 16:34:32 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <fstream>
using namespace std;
bool isLeter(char c);
int main()
{
ifstream input("text.in");
ofstream output("text.out");
int words=0,word_size=0;
char buff;
while(!input.eof())
{
buff=input.get();
if(isLeter(buff))
{
words++;
while(isLeter(buff))
{
word_size++;
buff=input.get();
}
}
}
output<<word_size/words;
}
bool isLeter(char c)
{
if((c>=65 && c<=90)||(c>=97 && c<=122))
return true;
else return false;
}
