Computing.Net > Forums > Programming > Counting without getche() function.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Counting without getche() function.

Reply to Message Icon

Name: Mikel
Date: May 17, 2003 at 20:41:45 Pacific
OS: win98
CPU/Ram: 166
Comment:

#include
#include
void main()
{
int count=0;
printf("\n\tType any phrase");
while(getche() !=13) //13 is For enter key
{
count++;
}
printf("\nCharactor count is =%d",count);
getch()
}
out put

Type any phrase
CAT
charactor count is 3

i want to count the charactors without using the getche() function. Is there any way to make the program to count the charactors without using getche()..? if yes then please write the programmm.i shall be soo much thankful to you.
thanks in advance...




Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: May 17, 2003 at 20:57:46 Pacific
Reply:

How about using gets() or fgets() to read a line into a character array and then loop thru the string counting the characters.

I'd write the program for you but I don't need the credits.


0
Reply to Message Icon

Related Posts

See More


Data not saving in Databa... a good book?



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Counting without getche() function.

c++ I/O www.computing.net/answers/programming/c-io/8108.html

C Program Simple Question (HELP...) www.computing.net/answers/programming/c-program-simple-question-help/10559.html

Program using queues in a class www.computing.net/answers/programming/program-using-queues-in-a-class/8604.html