My code below is six rows by six columns of zeros in which I would like to eventually like the last five left side cells to be numbered, and the last five top cells of the first column to be lettered. Kind of like so:
0 A B C D E
1 0 0 0 0 0
2 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 0 0 0
My code is as follows, but everything I try gets many errors so I keep erasing things I add. Any advice on getting the column and row headers?
Hi CRBottini, I assume your print function is supposed to output the entire vector?
You should change rowOne to someRow in the first loop of your print function. At the moment it is printing rowOne and not the parameter, someRow, that is passed to the print function.
As for the second for loop it is clearing someRow that is passed to the print function as a parameter. In other words, it is making your print function behave like your clear function. Are you sure this is what you are trying to do?
As for printing the column and row headers, there are several ways to do it...
In your main function, you can print the column headers by having a cout statement before all the print statements.
As for the row headers, you can simply cout the appropriate label before each print statement.
A more appropriate (and easier) way to do it would be to use an array of vectors. You can make use of the [ ] syntax and use a variable as your index of your vectors array. Then you can loop that variable to print out all the vectors.