Write a program that declares three one-dimensional arrays named price, quantity
ID: 3655496 • Letter: W
Question
Write a program that declares three one-dimensional arrays named price, quantity, and amount. Each array should be declared in main() and be capable of holding 10 double-precision numbers. The numbers to be stored in price arc 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. The numbers to be stored in quantity are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. Have your program pass these three arrays to a function called extend (), which calculates the elements in the amount array as the product of the equivalent elements in the price and quantity arrays: for example, amount [1] = price [1] * quantity [1]. After extend () has put values in the amount array, display the values in the array from within main(). Write the extend() function by using pointers.Explanation / Answer
#include #include using namespace std; void extend(double *p,double *q,double *a){ for(int i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.