Need help with format

closed account (jLA4LyTq)
I need help fixing the format please! It's supposed to look like this: https://www.google.com/search?tbs=sbi:AMhZZiu7PITwdGoOPw4gt-V_146FQN55I9ve5_1I7-qr4-Z4nu1LbSVpSh-HMdGi5ictOEZ_1nwkeWP-EDthfzq9pH5yZLlfJ4icnVc_1qNEf85scnbiGo1GScdBA3V1Z5i31fS4a_1Kph9nXg_13gG9aHdc34AuFEPjdp7e7C0OMK4IxYBjsGU6M8jSc2ivmisiQOTX2pR5LCmv41QwkT-SO_1bdiB13lYU6hmNganL-W4tf_1EnUqEye_1bbCZfouOrdZcYoXFRolJG5cwBO8gk78dpJutd9vqhC1REy8ywaoH_1X6DCA7BmnUND0ZeyStXbTABzFom6OsDKvBe4ZPeGZlFcbn5Jd_1MvWDTPaw#

But we don't have to worry about the font colors or bold style (ignore the red arrowhead before “Pct”)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// ConsoleApplication16.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
	cout << std::setw(20) << std::left << "NFC East team" << " W" << " L" << " T" << " Pct" << " PF" << " PA\n";
	cout << std::setw(20) << std::left << "Dallas Cowboys" << 13 << 3 << 0 << 813 << 421 << 306 << '\n';
	cout << std::setw(20) << std::left << "New York Giants" << 11 << 5 << 0 << 688 << 310 << 284 << '\n';
	cout << std::setw(20) << std::left << "Washington Redskins" << 8 << 7 << 1 << 531 << 396 << 383 << '\n';
	cout << std::setw(20) << std::left << "Philadelphia Eagles" << 7 << 9 << 0 << 438 << 367 << 331 << '\n';
	return 0;
}
You could use the std::setw. Now it affects only the team names.

Edit: It seems you already had a thread about this in http://www.cplusplus.com/forum/general/221489/
and the code you posted here is just a copy of what someone posted there.
Last edited on
Topic archived. No new replies allowed.