write a c++ program 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 program named dist, and then display the values in the dist array. your program should use pointer rotation when copying and displaying array elements.
i write this program. hope any1 could help me out.
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
const int MILES = 7;
int *dist;
int i, nums[MILES] = {15,22,16,18,27,23,20};
cout << "Miles" << "\t" << "Distance" << endl;
for (i=0;i< MILES; i++)
{
dist = nums;
cout << nums[i] << '\t' << *(dist+i);
cout << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
my teacher said that i will add functions to it. and im really confused about it and to the pointer rotation that will i add. please help me out guys. i really need this to pass my subject :) hope u can help me.