소수점 아래 몇자리까지 출력하라는 조건이 있을 때 쓰는 방법이다 cout << fixed; -> 소수점 아래 자리를 고정하고cout.precision(2); -> 소수점 아래서 n자리만큼 출력하겠다고 명시한다 double ans = 58.51354613 cout << fixed; cout.precision(2); cout << ans << "\n"; //58.51 728x90 반응형 공유하기 게시글 관리 컴공생의 끄적끄적 저작자표시