a C++ program (arrays and pointers)
Posted on 2007-07-22
I have this program to write in C++ and I have no idea how I should do it. Here is the details:
I have to write a C++ program that allows the user to enter 100 integer data values to fill up an array, and then does the following. Introduce three pointers(to int) p, q and r. Set p and r to point to the first entry in the array. Set q to point just beyond the last entry in the array. Without introducing any integer variables, set up a loop in which p is incremented until it also points just beyond the end of the array. Also (inside the loop), whenever p points to a number that is bigger than the number r points to, then change r so that it also points to the same number p points to.