본문으로 바로가기

C++setw()=함수

category C++ 2018. 3. 21. 03:09

the space coding

 



setw()=함수


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
32
33
34
35
 
 
 
setw()=함수
 
1.setw()는 c++함수이다.
 
2.setw()#include<iomanip>에 공표되어있는 함수이다.
 
3.setw()는 데이터가 출력 된 화면을 지정한 수만큼 폭을 정렬해준다.
 
 
#include <iostream>  
#include <iomanip>
 
using namespace std;
 
int main() {
 char a[16= { "kimSunYoung"  };//배열
 
 //cout.setf(ios::right);//우측 정렬
 //cout.setf(ios::left);// 좌측 절렬
 
 cout << setw(20<< a <<"\t"<< endl;//출력
 return 0;
}
 
출력결과
 
 
 
 
         kimSunYoung
계속하려면 아무 키나 누르십시오 . . .
 
cs


'C++' 카테고리의 다른 글

[C++][string만들기]  (0) 2018.04.16
[JAVA][instanceof 보자]  (1) 2018.03.22
[C++]깊은 대입연산자함수  (0) 2018.03.21
[C++] operator 함수  (0) 2018.03.21
스 택 Q  (0) 2018.03.21