#include <iostream>
using namespace std;
int main(){
int array[11], left_index = 0, second_index = 10;
for(int i = 0; i < 9; i++) array[i] = INT_MIN;
cout<<"Entering elements 1, 2, 3 and 4 in stack A...\n";
for(int i = 1; i < 5; i++){
array[left_index++] = i;
}
cout<<"Entering elements 9, 8, 7 and 6 in stack B...\n";
for(int i = 9; i >= 6; i--){
array[second_index--] = i;
}
cout<<"Stack A, Empty Space, Stack B\n";
for(int i = 0; i < 11; i++){
if(array[i] != INT_MIN) cout<<array[i]<<" ";
else cout<<"[ ] ";
}
return 0;
}
Comments
Leave a comment