setw( ) example

 

Contents


Description

This shows how to use setw( ) to display text with a certain width .

Code

//illustrates setting cout width

#include <iostream.h>
#include <stdlib.h>
#include <iomanip.h>

int main()
{

cout<<setw(20)<<"setw(20)"<<endl;
cout<<setw(10)<<"setw(10)"<<endl;
cout<<setw(15)<<"setw(15)"<<endl;

return 0;
}

Information

tested using Visual C++ 6 , Windows XP

Download

cppsetw.txt

 


Warning: include(300250.php) [function.include]: failed to open stream: No such file or directory in /home/program/public_html/cppsetw.php on line 144

Warning: include(300250.php) [function.include]: failed to open stream: No such file or directory in /home/program/public_html/cppsetw.php on line 144

Warning: include() [function.include]: Failed opening '300250.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/program/public_html/cppsetw.php on line 144