#include <iostream>
#include <conio.h>
using namespace std;
int main(void)
{
int foo;
int bar;
foo = 1;
bar = 1;
cout.setf(ios::right, ios::adjustfield);//오른쪽 정렬(left, right, internal)
cout.setf(ios::fixed, ios::floatfield); //부동소수 형태 설정
cout.precision(1); //정밀도 설정
cout.fill('0'); //공란을 채울 문자
//cout.setf( ios::hex, ios::basefield); // hex(16), dec(10), oct( 8 )
for (;foo<=9;foo++)
{
bar = 1;
for (;bar<=9;bar++)
{
cout.width(2); //출력 폭 설정 width는 매 cout마다 설정해야 함
cout << foo << " x ";
cout.width(2);
cout << bar << " = ";
cout.width(2);
cout << foo*bar << " "; // << endl;
if (bar == 5)
{
cout << endl;//"\t";
}
}
cout << endl;
}
system("pause");
return 0;
}
참고하숑
참고하숑 : Output Formatting
Posted by shiftkey


