The first input line contains the single integer N (1 ≤ N ≤ 100) – the number of pixels on the side of new square monitor. It is followed by N lines, each containing N positive integers not exceeding 100 divided by spaces. It is the image outputting by the usual video card (as you can see the color depth of new monitor is not so large – anyway usual programmer does not need more than 100 colors). Output
You are to write the program that outputs the sequence for input into the new monitor. Pixels are numbered from the upper-left corner of the screen diagonally from left ot right and bottom-up. There is no need to explain details – look at the sample and you'll understand everything.
Sample
input
4
1 3 6 10
2 5 9 13
4 8 12 15
7 11 14 16
output
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Here is what i understand so far. So i send in an input lets call it variable n. In case i enter n=4, it will ask for data entry for 4X4 matrix using 1 d array.After that, i will arrange it in ascending order that is 1,2,3... I have been told i will need to use a pointer for this but i haven't used pointer because number of arrays has to be judged(using n entered by user) at run-time.Is it possible to do this program without pointer.
I guess what you want is a dynamic array? Then yes you need a pointer. If you just want to have an array based on user input just declare the array after you've gotten n.
1 2 3 4 5
std::cout<<"Enter value for variable n: ";
std::cin>>n
int array[n][n];
No it doesn't say anything like that. I asked the professor and he told me it involves pointers and you can use 1d or 2d array. Its basically like arranging pixels(pixel-adapter) on a screen program. I don't think this can be done without arrays and pointer?