C++ examples for Language Basics:Console
Prints a table of team names and hits using width-modifying conversion characters.
#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; }