Advertisement
juinda

Untitled

Oct 28th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. // 20161029 phonenum.cpp : 定義主控台應用程式的進入點。
  2. //
  3.  
  4. #include "stdio.h"
  5. #include <ctype.h>
  6.  
  7. int main()
  8. {
  9. char s[100], two[] = { 'A','B','C' }, three[] = { 'D','E','F' }, four[] = { 'G','H','I' };
  10. char five[] = { 'J','K','L' }, six[] = { 'M','N','O' }, seven[] = { 'P','R','S' }, eight[] = { 'T','U','V' }, night[] = { 'W','X','Y' };
  11. while (gets(s) != NULL)
  12. {
  13. int i = 0,j=0;
  14. char num[7];
  15. while (*(s + i) != '\0')
  16. {
  17. if (isdigit(*(s + i)))
  18. {
  19. num[j] = *(s + i);
  20. printf("%c\n", num[j]);
  21. j++;
  22. }
  23. i++;
  24. }
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement