Parallel Arrays

I'm working on a program which deals with parallel arrays. The information is user entered and must be updated. I'm not sure if I wrote the user entering the information correctly and have no clue how to update the information. Please help.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void addphone (double productnum[], double price[], int quantityonhand[], int& add) {
    cout << "Enter product number, price, quantity on hand." << endl;
    int pn = 0;
    int pr = 0;
    int qoh = 0;
    cin >> pn >> pr >> qoh;
    pn = productnum[add];
    pr = price[add];
    qoh = quantityonhand[add];
    add++;
    for (int i = 0;i < add; i++) {
        cout << productnum[i]; << "\t" << price[i] << "\t" << quantityonhand[i] << endl;
    }
}

void updategame (double price[], price[], ) {
    
}
What exactly are you trying to achieve?

Here's what your addphone() function is doing so far:
1.)declare three integers and initialize them to zero.
2.)then, have the user enter values for the three integers.
3.)then, reassign new values to the integers found in the array arguments, effectively discarding the user input.
4.)print add number of elements of the arrays.
Topic archived. No new replies allowed.