dont no how to do it at all


create a program that creates an array of 10 integers.the users will be able to enter thr data. create a second array that contains the addresses of the different values in the first array. list the values in the first array by using the array of pointers in the second array.
What have you learned so far? Have you written any programs? Have you looked at any program code? Did the place where you did find your "homework" have any explanation about "arrays" and "pointers"?
no
hey liz99
because you didn't show any code of how you started, I made a simple program of what I think you were asking.

This should get you started, if not all you need
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>

using namespace std;

int main(){
    int arr[10];
    int *pArr[10];

    cout << "Enter 10 values into the array: \n\n\n";

    // Asking the user to input the values int the integer;
    cout << "Enter your first value: ";
    cin >> arr[0];
    for (int x = 0; x < 9; x++){
            cout << "Enter another value: ";
            cin >> arr[x+1];
    }

    //printing the array using its pointer;
    cout <<endl<<endl;
    for(int i= 0; i < 10; i++){
        pArr[i] = &arr[i]; // storing the address of each arr element into pArr
        cout << "The value of pArr["<<i<<"] is: " << *pArr[i]<<endl;
    }


    return 0;
}


if this isn't what you were talking about, paste a copy of the code you have worked on.
Last edited on
liz99 wrote:
no

Really? Why would anyone give you such a task that you have no means to do?
exactly and im just a beginner

Did the place where you did find your "homework" have any explanation about "arrays" and "pointers"?


@ keskiverto
I needed this today. lol! Thank you.
Topic archived. No new replies allowed.