Pagini recente » Cod sursa (job #19147) | Profil pestcontrol284 | Profil carm3n | Cod sursa (job #3291940) | Cod sursa (job #1661874)
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[1002];
int l,k,nrcuv=0,lcuv=0;
int main(){
while (f>>text){
l=strlen(text);
k=0;
for (int i=0;i<l;i++)
if (text[i]=='-' || text[i]==',' || text[i]=='.' || text[i]==' ' || text[i]=='?' || text[i]=='!')
k++;
if (l>k){
nrcuv=k+1;
lcuv=l-k;
}
}
g<<lcuv/nrcuv;
f.close();
g.close();
return 0;
}