Question: (Program) Write a program c++ that stores the following numbers in the array named miles: 15, 22, 16, 18, 27, 23, and 20. Have your
(Program) Write a program c++ that stores the following numbers in the array named miles: 15, 22, 16, 18, 27, 23, and 20. Have your program copy the data stored in miles to another array named dist, and then display the values in the dist array. Your program should use pointer notation when copying and displaying array elements.
This is what i have so far PLEASE HELP
#include
using namespace std; int main() { const int LENGTH = 7; int dist[7], miles[LENGTH] = { 15,22,16,18,27,23,30 }; int i; int *distPt, *milPt; distPt = dist; cout << "the elemets of the new array elements are" << endl; for (i = 0; i < LENGTH; i++) { *(distPt + i) =*(milPt + i); cout << *(distPt + i) << endl; }
system("PAUSE"); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
