Create two single dimension arrays that contain 10 floating-point numbers in each array. Create a third single dimension array to hold a sum. Your main program will take the two arrays of float and pass them to the function addfloat() Inside the function, add the first array to the second array and put the total into the third array. Print the values of all three arrays back in the main program. Here is what I have so far. I am baffled.
include
void addfloat(float a[], float b[], float c[]);
int d = 0;
for (d = 0; d < 10; d++)
{
c[d]=a[d]+b[d]
}
int main()
{
float RCT1[10] = {3.22, 9.99, 23.45, 1.50, 2.63, 11.50, 13.49, 100.88, 8.00, 33.19};
float RCT2[10] = {9.99, 8.33, 29.99, 14.07, 27.39, 12.28, 1.79, 47.99, 10.00, 13.99};
float TOT[10];
int a;
addfloat(RCT1, RCT2, TOT);
printf("\nReceipt 1 total: \n");
for (a = 0; a < 10; a++)
{
printf("%2.2f", RCT1);
}
printf("\nReceipt 2 total: \n");
for (a = 0; a < 10; a++)
{
printf("%2.2f", RCT2);
}
printf("\nTotal of receipts combined; \n");
for (a = 0; a < 10; a++)
{
printf("%2.2f", TOT);
}
return 0;
}