Electrical and Computer Engineering
2 of 52
UAH
CPE 112
setw
•setw (set width) lets us control how many character positions the next data item should occupy when it is output. (used for numbers and strings, not chars).
•The argument to setw is an integer fieldwidth specification, the data item is right-justified within the fieldwidth.
•If you don’t specify enough characters, the minimum number of characters is used anyway.