Hi Everyone,

I'm new to C++ and developing something to enhance my skill, however I find it difficult on
my knowledge right now, I want to write a program similar to SMS that everytime I input a character it will automatically increase my counter, and if i will press backspace, it will decrease my counter, any idea how to start it?Many thanks in advance.

Comments
i don't have any idea about c++

Hi Everyone,

I'm new to C++ and developing something to enhance my skill, however I find it difficult on
my knowledge right now, I want to write a program similar to SMS that everytime I input a character it will automatically increase my counter, and if i will press backspace, it will decrease my counter, any idea how to start it?Many thanks in advance.

Hi,

it's just my two cents.
1. you read the keyboard strokes
2. compare it with the ASCII code assigned to backspace
if it is not backspace, increment the counter along with displaying the counter and character.
else decrement.
NB:think of how your program should behave when "Enter" key is pressed

Hope it helps you to start with

Happy programming,
Bharath

Edited 5 Years Ago by ybkumar77: n/a

If you need to increase the count value whenever you press a key and decrease the count when you press backspace . For that You need to know Event Handling.

Google signal or event handling in C/C++ and you'll find what you want.

I dont know much about signal handling in C but java makes that task easier.

no need of doing event handling bro...relax just study ascii codes for backspace and enter key only....use loop to increment the counter eachtime key is pressed.....

Even for the backspace and enter key , you should handle the events for it.
However you need to know the ascii value of backspace and enter to compare what key have been pressed. But you can do that only if you handle the events....

This article has been dead for over six months. Start a new discussion instead.