siddhuoops
asked on
a C++ program (arrays and pointers)
Hi all,
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you both anthony2000 and jkr for guiding me to the right direction...yeah its a homework assignment and its a part of my project...i am completely aware of the fact that I am here for the guidance not to get a full solution..I should have mentioned that in my question...but the idea that you provided anthony2000 will definitely help me in completing my tasks...I will take that as a guideline and start working in it...thank you
If you have some code ready, then don't hesitate to post it here, and we can have a look at it to help you further in case that's needed.
Was I wrong to help the way I did???