-->
Showing posts with label WAP to generate given table using single cout.. Show all posts
Showing posts with label WAP to generate given table using single cout.. Show all posts

WAP to generate given table using single cout.

//program to generate following table using single cout statement
/*
1990    135
1991    7290
1992    11300
1993    16200
*/

#include <iostream>//header file
#include<iomanip>//header file for manipulator(width to print)

using namespace std;//to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler.
int main()//main function
{
    cout<<setw(4)<<"1990"<<setw(7)<<"135"<<endl
        <<setw(4)<<"1991"<<setw(7)<<"7290"<<endl
        <<setw(4)<<"1992"<<setw(7)<<"11300"<<endl
        <<setw(4)<<"1993"<<setw(7)<<"16200"<<endl;//we have used chaining concept.
                                                //for first column, we have used 4 boxes using setw(4) and
                                                //for second column, we have used 7 boxes. 5 boxes to print and 2 for space between columns.

    return 0;
}