Search Results for 'printf'

ATOM Icon

1 POSTS

  1. 2008/04/02 cout 사용법 몇가지 by shiftkey

cout 사용법 몇가지

#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



크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by shiftkey

2008/04/02 18:15 2008/04/02 18:15
,
Response
No Trackback , No Comment
RSS :
http://shiftkey.org/rss/response/128


블로그 이미지

Shiftkey가 살아가는 이런 저런 이야기......

- shiftkey

Notices

Archives

Authors

  1. shiftkey

Calendar

«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Site Stats

Total hits:
161250
Today:
31
Yesterday:
243