Pagini recente » Cod sursa (job #2762203) | Cod sursa (job #2423506) | Cod sursa (job #1127596) | Cod sursa (job #922636) | Cod sursa (job #2120563)
#include <iostream>
#include<fstream>
#include<string.h>
using namespace std;
char text[260];
int nr1,nr2,n,i,j;
int main()
{ifstream f("text.in");
ofstream g("text.out");
while(f.get(text,260))
{
n=strlen(text);
for(i=1;i<=n-1;i++)
if((strchr("-",text[i])) || (strchr(" ",text[i])))
nr1++;
nr1++;
if(text[0]=='-' )
nr1--;
if(text[n-1]=='-')
nr1--;
for(i=0;i<strlen(text);i++)
{if(((text[i]>='a') && (text[i]<='z')) || ((text[i]>='A') && (text[i]<='Z')))
nr2++;
}}
g<<nr2/nr1;
f.close();
g.close();
return 0;
}