Question: need help editing C++ program. need to change the implementation of the loop from iterating through the array to the use of a single pointer.

need help editing C++ program. need to change the implementation of the loop from iterating through the array to the use of a single pointer. don't change the functionality.

1. After the array is created, simply create a pointer variable called pNumbers and use that to print the values of the array.

int number[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int *pNumbers = number;

2. do some simple pointer arithmetic to change the address of pNumbers

here is what i have so far....

#include "stdafx.h"

#include

#include

using namespace std;

int main()

{ int number[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int size = sizeof( number ) / sizeof( number[0] );

for (int i = 0; i

{

cout number[" " ] = " number[i] // replace the code in bold with the pointer. Don't use the array

}

cout

system ("pause");

return 0; }

here iswhat theoutput should look...

need help editing C++ program. need to change the implementation of the

NunberLM Nunber J Nunber Nunber C3 Number 4 J Number 5 nber nber 17 Number Nunber 19 J Number Nunber 11 to continue Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!