C++ cout setw() Prints a table of names via width-modifying conversion characters.

Description

C++ cout setw() Prints a table of names via width-modifying conversion characters.

#include <iostream>
using namespace std;
#include <iomanip.h>
int main()//from  w w  w.ja va  2  s .  co  m
{
   cout << setw(10) << "Parrots" << setw(10) <<
   "Rams" << setw(10) << "Kings" << setw(10) <<
   "Titans" << setw(10) << "Chargers" << "\n";
   cout << setw(10) << 3 << setw(10) << 5 <<
   setw(10) << 2 << setw(10) << 1 <<
   setw(10) << 0 << "\n";
   cout << setw(10) << 2 << setw(10) << 5 <<
   setw(10) << 1 << setw(10) << 0 <<
   setw(10) << 1 << "\n";
   cout << setw(10) << 2 << setw(10) << 6 <<
   setw(10) << 4 << setw(10) << 3 <<
   setw(10) << 0 << "\n";
   return 0;
}



PreviousNext

Related