#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define doSomethingElse(input) do{ printf("your input is %d\n", input); }while(0)
int main(void) {
int input, iInput[10];
int status, iNum;
char cInput1[50], cInput2[50];
// Identify wether it is a letter or a number
/*
while ((status = scanf("%d", &input)) != EOF) {
if (status == 0) {
printf("Not a number\n");
while (getchar() != '\n'); //clear input
}
else {
doSomethingElse(input);
printf("%d\n", status);
}
}
*/
// What is the different between fputs and printf
/*
fputs("Please enter string : ", stdout);
fgets(cInput1, 50, stdin); // input with '\n' at the end
cInput1[strlen(cInput1) - 1] = NULL; // replace last character with NULL
printf("Please enter string : ");
scanf("%s", cInput2);
puts(cInput1); // output with '\n' at the end
puts(cInput2);
fputs(cInput1, stdout); // output without '\n' at the end
fputs(cInput2, stdout);
printf("%s", cInput1); // output without '\n' at the end
printf("%s", cInput2);
*/
// What ist the diffrent between fgets and scanf
fputs("please enter number : ", stdout);
fgets(iInput, sizeof(iInput), stdin);
//scanf("%d", iInput+9);
//scanf("%d", iInput+8);
//iInput[9] = 33;
//atoi(iInput);
//printf("%d\n", iInput[9] + iInput[8]);
//puts(iInput);
fputs(iInput, stdout);
}
C++ 02.06 - 부동 소수점 숫자 (floating point numbers) setprecision
출처: https://boycoding.tistory.com/152 [소년코딩]
https://boycoding.tistory.com/152
'my_lesson > _C' 카테고리의 다른 글
C - malloc_ c 메모리 동적할당 (0) | 2019.03.08 |
---|---|
9. C_lesson 3차원 배열이 매개변수로 사용된 함수 (0) | 2014.04.07 |
8. C_lesson 단항 연산자 !not,~비트not,+,- (0) | 2013.10.09 |
7. C_lesson 별로만든 뒤집어진 트리 program (0) | 2013.09.29 |
6. C_lesson 별로만든 트리 program (0) | 2013.09.29 |
댓글