Check my Program. Give me Suggestions please.

Check my Program. Give me Suggestions please.

The machine problem is:

Write a program that will identify word that the user inputs and determine how many times that word uses the certain letters, that the word contains. And the letters will be in alphabetical order.
The program must not accept a numeric value and special characters except the "-" that is needed in compound words as input .

Example :

I enter the word "letters"

The program must show:

e = twice
l = once
r = once
s = once
t = twice

If I enter the word "add5@6" with number or special character in the input word
the program will say "Wrong input" and will require the user to input another word.




#include <stdio.h>
#include <conio.h>
void main()
{
1. char str[80];
2. int i,a,b;
3. clrscr();
4. printf("Enter a string less than 80 characters: ");
5. gets( str );
6. i = 0;
7. a = 0;
8. b = 1;

9. while (str[i])
{
10. if (((str[i] >= 65) && (str[i] <= 90)) || ((str[i] >= 97) && (str[i] <= 122)))
{

11. if (str[a]==str[b]?printf("=%d", b): printf("=0"));
{
12. printf("%c\n",str[i]);
13. i++;
14. a++;
15. b++;
}
16. else
{
17. printf("Wrong Input.");
18. break();
}
}
}
19. getch();
}


i have problem in :
line 1 that should be any number of input not only 80 but if i put str[] the program will say that i must put a number in it.
line 17&18 after the wrong input will appear the program must start again and ask the user to enter another in put in a new screen. i put break to break the wrong input loop.

I believe my program needs more adjustment in order to achieve the machine problem. I need your tips and hints from the experts.
Feel free to comment and add some suggestions.

Thanks.
I can't see, eather I'm blind or you didn't use code tags.
I say we start a new rule, if someone is too lazy to use code tags, then we don't help them. I was gonna tag this for him/her, but... I didn't want to deal with the line numbers.

Word of advice, edit your post using code tags
Topic archived. No new replies allowed.