Write a program in C++ to align the text with equal spacing using manipulators - WAY2IT

Latest Post :

Home Top Ad

Write a program in C++ to align the text with equal spacing using manipulators



Code :-

#include <iostream.h>
#include <iomanip.h>
#include<stdlib.h>
#include<conio.h>
void main( )
{
clrscr();
int x1=12345,x2= 23456, x3=7892;
cout << setw(8) << "Exforsys" << setw(20) << "Values" << endl;
cout<< setw(8) << "E1234567" << setw(20)<< x1 << endl;
cout<< setw(8) << "S1234567" << setw(20)<< x2 << endl;
cout<< setw(8) << "A1234567" << setw(20)<< x3 << endl;
getch();
}



Output :-