입출력 조작
IO manipulator(Input output manipulator)
입출력 조작
실습 예제
ch01ex3_입출력조작.cpp
// ch01ex3_입출력조작.cpp
#include <iostream>
#include <iomanip> // input output manipulator
using namespace std;
int main()
{
int n = 13;
cout << "10진수 " << n << endl;
cout << "10진수 " << n << "은 8진수로 " << setbase(8) << n << "입니다." << endl;
cout << "10진수 " << setbase(10) << n << "은 16진수로 " << setbase(16) << n << "입니다." << endl;
cout << endl << endl;
double f = 3.141592;
cout << "PI는 " << f << "입니다." << endl;
cout << "PI는 " << setprecision(3) << f << "입니다." << endl;
cout << "PI는 " << setprecision(4) << f << "입니다." << endl;
cout << "PI는 " << setprecision(5) << f << "입니다." << endl;
cout << endl << endl;
return 0;
}ch01ex4_출력폭.cpp
실습 문제
ch01lab3_구구단.cpp
구구단 중 n단을 출력하는 코드를 작성하시오. (변수 n은 5로 초기화)
Last updated