Assignment help ! :/

Hello,

im trying to convert this to use it only with <iostream.h>
its not that hard i know but it's not working with me
specially printf("%8.2f", sales[i][j]); part

i hope someone can help with it :/

thnx for reading.


void printSales(float sales[ ][5])
{
float totalSales;
int i, j;
float productSales[5] = {0.0};

for (i = 0; i < 4; i++)
{
totalSales = 0.0;
printf("%3d ", i+1);

for (j = 0; j < 5; j++)
{
totalSales += sales[i][j];
productSales[j] += sales[i][j];
printf("%8.2f", sales[i][j]);
}

printf("%8.2f\n", totalSales);
}

printf("Total ");

for (j = 0; j < 5; j++)
printf("%8.2f", productSales[j]);

printf("\n");
}
im trying to convert this to use it only with <iostream.h>
First of all it is <iostream>. Second, if your compiler allows <iostream.h>, update it ASAP: that thing is probably older than you.

I still do not understand what do you want. Replace all printf statement with stream operations? Just to std::cout << <whatever variable you have>. If you want your code to look like table, include <iomanip> and use std::setw()
Topic archived. No new replies allowed.