Pagini recente » Cod sursa (job #867053) | Cod sursa (job #2680549) | Cod sursa (job #3151431) | Cod sursa (job #1225693) | Cod sursa (job #384625)
Cod sursa(job #384625)
#include <fstream>
#include <string>
using namespace std;
ifstream in ( "text.in" );
ofstream out ( "text.out" );
int cntl, cntc;
bool litera ( char c )
{
return ( c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' );
}
int main ()
{
//if ( litera ( s [ 0 ] ) ) ++cntc, ++cntl;
char s;
bool cuvant = false; int i = 1;
in >> s;
if(litera(s))
{
++ cntl;
++ cntc;
cuvant = true;
}
while ( in >> noskipws >> s )
{
if ( litera ( s ) )
{
++ cntl;
if(!cuvant)
++cntc;
cuvant = true;
}
else
cuvant = false;
}
if ( cntc == 0 ) out << "0";
else out << cntl / cntc;
return 0;
}