Pagini recente » Cod sursa (job #1897213) | Cod sursa (job #3163184) | Cod sursa (job #1240562) | Istoria paginii runda/becreative4 | Cod sursa (job #1535428)
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char text[256],v[]=",.!?-:;",*sp,*q,k=0;
int lung_text=0,nr_cuv=0;
f.get(text,256);
while(k<=strlen(text)-1 && (strchr(v,text[k]) || text[k]==' '))
{
k++;
}
strcpy(text,text+k);
if(strchr(v,text[strlen(text)-1]))
text[strlen(text)-1]=NULL;
for(int i=0;i<=strlen(text)-1;i++)
{
if(('a'<=text[i] && text[i]<='z') || ('A'<=text[i] && text[i]<='Z'))
lung_text++;
else
{
nr_cuv++;
}
}
g<<lung_text/nr_cuv;
}