Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Simply document this program... explain the steps. #include <iostream> using nam

ID: 3547020 • Letter: S

Question

Simply document this program... explain the steps.

#include

<iostream>

using

namespace std;

const

int size = 10;

struct

node

{

  

int data;

   node *next;

   

char ch;

};

int

main()

{

node *ptr;

int *p;

   

int i, j, *first;  

   cout <<

" enter size of new array: ";

   cin >> j;

   ptr =

new node[j];

   p =

new int[j];

   first = p;

   

for ( i=0; i<j;i++)

   {

    cout <<

" enter data: ";

      cin >> *p;

      cout <<

" enter character: ";

      cin >> ptr[i].ch;

      ptr[i].data = *p;

      p++;

   }

   p = first;

   

for (i=0; i<j;i++)

   {

    cout <<

"   " << *p << "   " << ptr[i].data << ptr[i].ch;

      p++;

   }

   p--;

   

for (i=0; i<j;i++)

   {

    cout <<

"   " << *p;

      p--;

   }

   

char c;

   cin >> c;

   

return 0;

}

Explanation / Answer

1. This program will first request for the array size from the user.

2. depending on that input it will create the array of structures and integer dynamically.

3. now it will request the user for the data and character for array size times and fill the data in the array of sturctures.

4. after that it will print that data and charater till it reach the array end.

5. at last we are requesting for the data and stores in a charater.