Advertisement
MUstar

IoT C언어 0703 - EX_03_1

Jul 3rd, 2017
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h> //atoi는 이 해더파일을 사용.
  3.  
  4. {
  5.     int cnt=0;
  6.     char num[10];
  7.     while(1)
  8.     {
  9.         num[cnt] = getchar();
  10.         if(num[cnt]==10) break;
  11.         cnt++;
  12.     }
  13.     printf("%d\n", atoi(num)+10);
  14.    
  15.     return 0;
  16. }
  17.  
  18. /*
  19. atoi()는 ASCII to Integer의 약자로써 말그대로 아스키코드를 정수형 int로 변환해주는 함수이며 stdlib.h에 포함되어있습니다.
  20. 어거 말고도 atol()와 atof()는 각각 정수형 long와 실수형 float(또는 double)로 변환해는 함수도 있으며
  21. 반대로 숫자를 아스키코드로 변환하는 itoa()함수도 있습니다.
  22. 그리고 64비트환경에서는 _atio64()도 사용가능하지만 32비트를 초과한 값이 아닌 이상사용을 추천하지는 않습니다.
  23. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement