No clue how to start?

closed account (jLA4LyTq)
So i just transferred into a computer science and im like two weeks behind. I have no clue how to even start this project, please help!
Problem Statement: Your job is to write a C++ program that will print out the following table in a console window:


e discussed in class

I dont know where to start, please help!
Last edited on
unclear what you learned in class but you probably want to learn how to format text using cout statements.

but lets back up.
Can you write the hello world program and get that to work?
That is, have you learned the most basic starting point stuff yet?
I clicked your link and didn't see anything?

If you need help, email me at sparkprogrammer@gmail.com

I tutor people in C++, so maybe I can help.

Joe
www.concordspark.com
It seems your teacher wants you to work on input/output manipulators for a while.
So:
a) copy that table in a list of lines to be displayed on screen.
Ok, I’ve already done it for you:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

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

(Check if there are errors, please)
Now, if you execute the above code, the result is far from legible:
NFC East team W L T Pct PF PA
Dallas Cowboys1330813421306
New York Giants1150688310284
Washington Redskins871531396383
Philadelphia Eagles790438367331

Can you see the problem? Spaces between columns are missed.
So:
b)
See how close you can get to this table using the formatting tools we discussed in class

You should know what the ‘formatting tools’ are, but I’m giving you three hints:
http://en.cppreference.com/w/cpp/io/manip
https://www.youtube.com/watch?v=TmFNZxDw9mk
A code to start with:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iomanip>
#include <iostream>

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


c) Teachers usually feel depressed when they discover their students ask for assignment solutions on forums, and they also browse forums to catch them.
I suppose nobody has ever told it you, otherwise you wouldn’t have posted with your real name (ok, maybe that isn’t your real name).
Also, a lot of people on forums disapprove those who give solutions to assignments.
I think you'd better ask for help on errors on your code than for entire solutions.
he did not ask for a solution, he asked for help to get started:
"I dont know where to start, please help! "
jonnin, I stand corrected.
Topic archived. No new replies allowed.