>I don't mind suggestions!!!!!
Get all of the input and calculate the results as you go, placing the values in a 2D array. When you're done taking input, print out the contents of the array. For the total, keep an extra variable to add it all to and print that last. Here's a working example you can use as a template:
Code:
#include <stdio.h>
int main ( void )
{
int i;
double net,
rate,
allTotal = 0.0;
double table[3][4];
for ( i = 0; i < 3; i++ ) {
printf ( "Enter net and rate: " );
if ( scanf ( "%lf %lf", &net, &rate ) == 2 ) {
table[i][0] = net;
table[i][1] = rate;
table[i][2] = net * rate;
table[i][3] = net + ( net * rate );
allTotal += table[i][3];
}
}
for ( i = 0; i < 3; i++ ) {
printf ( "%.2f\t%.2f\t%.2f\t%.2f\n", table[i][0],
table[i][1], table[i][2], table[i][3] );
}
printf ( "All Total: %.2f\n", allTotal );
return 0;
}
I must stress that error handling is very important, I didn't include any so I'm setting a bad example, but adding it would detract from the concept of the processing. Checking return values from user input is a must in any program though, always include it. Notice how I checked that scanf succeeded, the user is a moron and you have to code for that.
-Prelude