write a program that describes three one dimensional array n

write a program that describes three one dimensional array named price,quantity, and amount. eacch array should be declared in main() and be capable of holding 10 double-precison numbers. the numbers to store in price are 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. the numbers to store in quantity are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. the program should pass these three arrays to a function named extend(), which should calculate elements in the amount array as the product of the corresponding elements in the price and quantity arrays. after extend() has passed values to the amount array, the values in thee array should be displayed from with in main. only using #include using c++

Solution

#include<iostream.h>
#include<conio.h>


double extend(double price[10],double quantity[10], double amount[10])
{

for(i=0;i<10;i++)
{
amouny[i]= price[i]*quantity[i];
}

return amount;

}


void mainn()
{
double price[10]={10.62,14.89,13.21,16.55,8.62,9.47,6.58,18.32,12.15,3.98};
double quantity[10]= {4,8.5,6,7.35,9,15.3,3,5.4,2.9,4.8};
double amount[10];

amount[] = extend(price,quantity,amount);

cout<<\"Elements of array amoutn\";
for(i=0;i<10;i++)
{
cout<<amount[i];

}


}

write a program that describes three one dimensional array named price,quantity, and amount. eacch array should be declared in main() and be capable of holding

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site