Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. int getnum(void)
  2. {
  3. int result = 0;
  4. int run = 1;
  5. while (run)
  6. {
  7. while (getkey() != -1);
  8. while (getkey() == -1);
  9. if ((mapkey(getkey()) >= 0) && (mapkey(getkey()) <= 9))
  10. {
  11. result = ((result * 10) + (mapkey(getkey())));
  12. }
  13. if (mapkey(getkey()) == '*')
  14. {
  15. result /= 10;
  16. }
  17. if (mapkey(getkey()) == '#')
  18. {
  19. run = 0;
  20. }
  21. }
  22. return result;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement