1
Construct the following program:
#include <iostream>
#include <stack>
using namespace std;
struct Register{
    string name;
    int birth;
    char sex;
    void Insert(string st_name,int st_birth, char st_sex){
        name=st_name;
        birth=st_birth;
        sex=st_sex;
    }
};
stack <Register> stack_register;
int main(void){
    Register data[5];
    data[0].Insert("Pkrtvx",151,'M');
    stack_register.push(data[0]);
    data[1].Insert("IKXS_36080",159,'M');
    stack_register.push(data[1]);
    return 0;
}
My doubts:
- Did I enter the data from - structin my- stackin the right way?
- How do I show the top element in this case? Because every time I use the top finished one returns an error. 
See the code below to understand:
#include <iostream>
#include <stack>
using namespace std;
struct Register{
    string name;
    int birth;
    char sex;
    void Insert(string st_name,int st_birth, char st_sex){
        name=st_name;
        birth=st_birth;
        sex=st_sex;
    }
};
stack <Register> stack_register;
int main(void){
    Register data[5];
    data[0].Insert("IKXS_36080",125,'M');
    stack_register.push(data[0]);
    data[1].Insert("IKXS_36080",105,'M');
    stack_register.push(data[1]);
    cout << stack_register.top(); //O erro estar aqui
    return 0;
}
Can [Edit] the question and add the error message?
– Woss