#include <iostream>
#include <stack>
using namespace std;
class Student{
public:
string N, S;
int M;
Student(){
}
Student(string N, string S, int M){
this->N = N;
this->S = S;
this->M = M;
}
void show(){
cout<<"Name: "<<this->N<<endl;
cout<<"Surname: "<<this->S<<endl;
cout<<"Marks: "<<this->M<<endl<<endl;
}
};
int main(){
stack<Student> St3, St2, St1;
St1.push(Student("Sam", "Williams", 60));
St1.push(Student("John", "Phoenix", 85));
St1.push(Student("Simon", "Johnson", 75));
St1.push(Student("Sarah", "Khosa", 81));
St1.push(Student("Mat", "Jackson", 38));
St1.push(Student("Nick", "Roberts", 26));
St1.push(Student("Isaac", "Wayne", 74));
St1.push(Student("Anna", "Mishima", 34));
St1.push(Student("Daniel", "Rose", 64));
St1.push(Student("Aaron", "Black", 83));
St1.push(Student("Jack", "Mohamed", 27));
St1.push(Student("Kathrine", "Bruckner", 42));
Student S1;
cout<<"Displaying contents of Stack 3\n";
while(!St1.empty()){
S1 = St1.top();
S1 .show();
St3.push(S1 );
St1.pop();
}
while(!St3.empty()){
St1.push(St3.top());
St3.pop();
}
while(!St1.empty()){
S1 = St1.top();
if(S1.S[0] == 'R' || S1.S[0] == 'J' || S1.S[0] == 'M'){
St2.push(S1);
}
St3.push(S1);
St1.pop();
}
cout<<"Displaying contents of Stack 2\n";
while(!St2.empty()){
S1 = St2.top();
S1.show();
St2.pop();
}
return 0;