Wednesday, 21 April 2021

setw() in C++

 #include<iostream.h>

#include<conio.h>

#include<iomanip.h>

int main()

{

clrscr();

cout.setf(ios::adjustfield,ios::left);

cout<<setw(20)<<"Amit"<<setw(10)<<45<<endl;

cout<<setw(20)<<"Ram Kumar"<<setw(10)<<45.67<<endl;

cout<<setw(20)<<"Amitabh Kumar"<<setw(10)<<46<<endl;

cout<<setw(20)<<"Vikas"<<setw(10)<<56.55<<endl;

getch();

return 0;

}

No comments:

Post a Comment