how do you write a code regarding the push/pop data array display except the function undeletes the elements of an array, meaning the most recently removed value is restored or undeleted.... I have the code to insert
1 2 3 4 5 6 7 8 9 10
if (!isFull())
{
data[++count] = value;
cout << setw(4) << value << " has been inserted in data[" << count << "]." << endl;
}
else {
cout << "Attempts to insert a value into a full container; program is terminated!";
exit (1);
}
and to display
1 2 3 4 5 6 7 8 9 10
cout << "The 'container' contains the following " << count + 1 << " value(s):\n";
if (count == -1)
cout << "*** data array is empty!" << endl;
else
{
for (int i = 0; i <= count; i++)
cout << data[i] << '\t';
cout << endl;
}
}
and to remove
1 2 3 4 5 6 7
if( isEmpty( ) ) // the stack is empty
{
cout << endl << “Stack is empty” << endl;
exit( 1 );
}
value = data[ count ];
count-- ;}
but i don't know the code to unremove.
Please help, Thanks!