I am learning about arrays , what I wanted to try is first let the user enter x,y values 4 times e.g
first time
x = 1 y = 3 second time
x = 2 y = 3 third time
x = 3 y = 1 fourth time
x = 1 y = 3 . and then store the value that the user had key in 4 times inside a array and print them out but I getting some weird outputs.
my output
10001711642800 <-- some weird output expected output
1,3 2,3 3,1 1,3 code(not working)
int x; int y; //request the user to enter x and y value 4 times. for (int i=1; i<5; i++) { cout << i << "Please enter x-cord." << endl; cin >> x; cout <<i << "Please enter y-cord." << endl; cin >> y; } //intitalize the array size and store the x,y values int numbers[4][4] = { x, y }; //loop through 4 times to print the values. for (int i = 0; i<5; i++) { cout << numbers[i][i]; } I know it can be done with vectors but now I am trying with arrays because I am weak in using arrays.