Monday 22 April 2013

Creating Columns using "SETW" Operator

Description:

In c++ "Setw(x)" operator is used to separate columns up to 'x' units. It stands for set width. Used in making tables.

Code:


#include<iostream>
#include<conio.h>
#include<iomanip>
using namespace std;
int main()
{
    cout<<setw(6)<<"62"<<setw(6)<<"8"<<endl;
    cout<<setw(6)<<"100"<<setw(6)<<"77"<<endl;
    cout<<setw(6)<<"5"<<setw(6)<<"162"<<endl;
    getche();
    return 0;
    }


Output:


No comments:

Post a Comment