-
September 27th, 2010, 02:21 AM
#1
C coding to print the value until next Key Stock?
Here i need to get Keybaord input but process should not wait for keybaord input
whenever Key is pressed corresonding action should take place
eg. if first time i pressed '+' the i value should be incremented until
next key is pressed and if '-' is pressed then i value should be decremented
until next key is pressed. pls refer & check complete the following code.
void main()
{
int i=0;
char ch='*';
while(1)
{
/* Here i need to get Keybaord input but process should not wait for keybaord input
whenever Key is pressed corresonding action should take place
eg. if first time i pressed '+' the i value should be incremented until
next key is pressed and if '-' is pressed then i value should be decremented
until next key is pressed.
*/
KeyInput = ReadKeybaordInput();
if(KeyInput == '+')
printf("\n i=%d",i++);
else if(KeyInput == '-')
printf("\n i=%d",i--);
else if(KeyInput == '*')
printf("\n i=%d",i);
else if(KeyInput == '/')
exit(0);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|