The following program is actually written to count the number of alphabet in a .txt file. But the problem is that it gives different outputs every time. What am I doing wrong here?
alph[] is an uninitialized array. What do you think it contains? hint: garbage.
main should return type int.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
- int main(), not void main()
- conio is not a standard header file, to be avoided
- if(alph[i]!='\0') is not sufficient check for alphabet, it'll pick up numbers, punctuation, etc