How to store values in an array?

How to store values in an array? I'm making this program. But I want to use the values 'y' which I put in the list below. I guess I need an array which will store those values? So how can i do that?

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 x;
    int y;

    for(x=1 ; x<=10; x++)
    {
        cout << "Enter the number of pancakes eaten by "<< x << "." << endl;
        cin >> y;
    }

    cout << "Person    -    Pancakes\n";




    for (x=1 ;x<=10; x++)
    {
        cout << x << "    -    "<< y << endl;
    }
return 0;

}
Last edited on
Topic archived. No new replies allowed.