Skip to content

C++ Program to Display Data Variable using setw Manipulator Function

C++ Program to Display Data Variable using setw Manipulator Function

Code:

/*C++ Program to Display Data Variable using setw Manipulator Function*/
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main(void)
{
 int a=100,b=200;
 clrscr();
 cout<< setw 5) << a << setw(5) << b << endl;
 cout<< setw(6) << a << setw(6) << b << endl;
 cout<< setw(7) << a << setw(7) << b << endl;
 getch();
}

Sample Output:

Comment bellow for your Query and Feedback

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!