Prints a table of team names and hits using width-modifying conversion characters. - C++ Language Basics

C++ examples for Language Basics:Console

Description

Prints a table of team names and hits using width-modifying conversion characters.

Demo Code

#include <iostream>
#include <iomanip>
using namespace std;
int main()//  ww w .j a  v  a 2s .  c om
{
   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;
}

Result


Related Tutorials