목차
1주 - Real Number Representation
본문내용
#include
#define INPUT_SIZE 10
#define FLOAT_SIZE 32
typedef union {
float floatType;
unsigned long bit32Type;
}UFLOAT;
float strTofloat(char* str);
void printBit_Float(float userRealNum);
int main()
{
char inputStr[11] = {0};
float outputNum = 0.0;
// 입력받기
printf("------------------------------------------------\n");
printf("Input a real number (below 10characters) >> ");
scanf("%11s", inputStr);
// 입력오류검사
if(inputStr[10]!=0){
printf("Error:below 10characters\n");
return 0;
}
//strTofloat함수실행
outputNum = strTofloat(inputStr);
//strTofloat함수실행결과출력
printf("\nstrTofloat returned : %f\n", outputNum);
printBit_Float(outputNum);
return 0;
}
#define INPUT_SIZE 10
#define FLOAT_SIZE 32
typedef union {
float floatType;
unsigned long bit32Type;
}UFLOAT;
float strTofloat(char* str);
void printBit_Float(float userRealNum);
int main()
{
char inputStr[11] = {0};
float outputNum = 0.0;
// 입력받기
printf("------------------------------------------------\n");
printf("Input a real number (below 10characters) >> ");
scanf("%11s", inputStr);
// 입력오류검사
if(inputStr[10]!=0){
printf("Error:below 10characters\n");
return 0;
}
//strTofloat함수실행
outputNum = strTofloat(inputStr);
//strTofloat함수실행결과출력
printf("\nstrTofloat returned : %f\n", outputNum);
printBit_Float(outputNum);
return 0;
}
소개글