#include <cstdlib>
#include <iostream>
#include <stack>
using namespace std;
stack<char> sa, sb,sc;
int main(int argc, char *argv[])
{
for(char i='A';i<='C';i++)
sa.push(i);
for(char i='D';i<='F';i++)
sb.push(i);
//penggabungan
while(!sa.empty()){
sc.push(sa.top());
sa.pop();
}
while(!sb.empty()){
sc.push(sb.top());
sb.pop();
}
while(!sc.empty()){
cout<<" "<<sc.top()<<endl;
sc.pop();
}
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
#include <stack>
using namespace std;
stack<char> sa, sb,sc;
int main(int argc, char *argv[])
{
for(char i='A';i<='C';i++)
sa.push(i);
for(char i='D';i<='F';i++)
sb.push(i);
//penggabungan
while(!sa.empty()){
sc.push(sa.top());
sa.pop();
}
while(!sb.empty()){
sc.push(sb.top());
sb.pop();
}
while(!sc.empty()){
cout<<" "<<sc.top()<<endl;
sc.pop();
}
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}