C++, scanf 에서 float 사용하기
C++, scanf 에서 float 사용하기 scanf에서 double 형으로 처리하려는 분들이 많으신데 %lf를 사용하면 double 형으로 받을 수 있습니다. #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { int a; double b,c,d; printf("키는?"); scanf("%d",&a); printf("체중은?"); scanf("%lf",&b); c = (a-100)*0.9; d = b-c; printf("키가%d 인사람의표준체중은%.1lf 이며, 현재체중과표준체중의차이는%.1lfKg이다\r\n",a,c,d); return 0; } double 대신 float 를 사용 #include "stdafx.h" int _tmain(int a..
더보기