Pagini recente » Cod sursa (job #914324) | Cod sursa (job #295661) | Cod sursa (job #715415) | Cod sursa (job #2497139) | Cod sursa (job #805770)
Cod sursa(job #805770)
#include<iostream>
#include<string.h>
#include<fstream.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char text[100],*p,sep[]=" ?.!-";
int lungime=0,nrcuv=0,i=0;
f.get(text,100);
p=text;
while (*p)
{
for(i=0;i<=strlen(sep);i++)
if(*p==sep[i])
nrcuv++;
if((int(*p)>64&&int(*p)<91)||(int(*p)>96&&int(*p)<127))
lungime++;
p++;
}
g<<lungime/nrcuv;
f.close();
g.close();
return 0;
}