0
Mentor
Quote:
What can I say, I'm a beginner.
You can say: you've tried my suggestions and post the new (non-working) code WITH the changes. I'm not going to repeat myself as I have done previously.
0
Light Poster
Here is the new code:

Code:
```#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <iostream.h>
#include <string.h>

void main()
{
char cons[21]={'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'};
char s[30],x[30][30],z[30]; int i,j=0,k=0,r,f,n,poz,c,max;
clrscr();
printf("Dati propozitia:");
gets(s);n=strlen(s);r=0;k=0;

for(i=0;i<n;i++)
{
if((s[i]!=' ')&&(s[i]!='.')){x[r][k]=s[i];k++;
}
if((s[i]==' ')||(s[i]=='.')){x[r][k]='\0';r++;k=0;
}}

for(i=0;i<r;i++)
for(j=0;j<strlen(x[i]);j++)
for(k=0;k<21;k++)
if(x[j]==cons[k])
{
c++;
}
z[i]=c;
max=z[0]; poz=0;
for(i=0;i<r;i++)
if(max<z[i])
{
max=z[i];poz=i;
}
puts(x[poz]);
}```

Last edited by shabbir; 25May2011 at 09:02.. Reason: Code blocks
0
Light Poster
Is there somebody who can help me? Please, I'm desperate.
0
Mentor
OK, *one* repeat.

1. create a program as a start that just displays individual words

2. After that, count the number of consonants in each word and store (a) the number if it's the largest so far and (b) the word itself. Display these results as you calculate them.

3. Use meaningful variable names

4. Indent code correctly

5. You can identify code problems by adding printf statements to it that display intermediate results and ensure that what the program is doing corresponds to what you think it is doing.

You can almost certainly solve the problem yourself using these techniques.