Use Of Setw Function
Write a simple program using setw function....
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class wk
{
private:
int age;
char name[50];
public:
void put()
{
cout<<"\n Enter the name: ";
cin>>name;
cout<<"\n Enter the age: ";
cin>>age;
}
void get()
{
cout<<" Name=== "<<setw(20)<<name<<endl;
cout<<" Age=== "<<setw(20)<<age<<endl;
}
};
void main()
{
clrscr();
wk w;
w.put();
w.get();
getch();
}
Here is the output :)))
No comments:
Post a Comment