How to take input from user in stack<pair<int, int> > s;

how to take input from user in stack<pair<int, int> > s;

@talhashamim001 @Vaibhav_goyal277 plz help im stuck

hi @utkarsh.gupta0311 where do u need this stack of pairs this question doesnt need that, use simple stack

as in the question input is like
2 73
2 43
thats why i took a stack of pairs

@utkarsh.gupta0311, refer this is simple solution

i thought if s.top().first is 1 i pop and print
if its 2 i push s.top().second

@utkarsh.gupta0311 no just use the first no to see whether u need to push or pop

ohhkk i understood the mistake … but is it possible to take input from user in a stack of pair???

@talhashamim001 is it possible?

hi @utkarsh.gupta0311 yes

how can u share some blog to learn

hi @utkarsh.gupta0311 https://www.geeksforgeeks.org/stack-of-pair-in-c-stl-with-examples/

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.