I am trying to create a table based on prices entered. In the other part of the program (not shown) it deals with actually inputing the prices. This part below deals with the way that the actually pieces entered will be displayed. I need help with this 2 dimensional array because when i run the program, the prices i entered show up in a straight line.
[ Ex= 4.305.403.602.30]
I need it too like like this.
Ex =
4.30 5.40
3.60 2.30
(in a table format)
I tried using setw() but it did not change anything. Please help me to be able to change the format in this void function. Thankyou in advanced. Btw I'm using Xcode.
void printPrices(PriceType table, int numOfRows, int numOfCols)
{
cout << fixed << showpoint << setprecision(2);
for (int row = 0; row < numOfRows; row++)
{
for (int col = 0; col < numOfCols; col++)
Well, you need them to not be in a straight line, right? After each column? Just add a cout << endl; line where you want the lines to be, and it will give you the result you're looking for. In this case, it would be after every iteration of the for loop to iterate through rows, so add it after the column for loop but still within the row for loop.