স্ট্যাক এর বৈশিষ্ট্য হল Last In First Out(LIFO).
# স্ট্যাক ডিক্লেয়ার :
- stack<int>st ;
# স্ট্যাক এ ডাটা Insert :
- st.push(100) ;
# স্ট্যাক থেকে ডাটা Delete :
- st.pop() ;
স্ট্যাক এর এই ফাংশনটি স্ট্যাক এর top value টি মুছে দেয়।
# স্ট্যাক এর top value Access :
- st.top() ;
# স্ট্যাক থেকে কোন value print করতে হলে :
while(!st.empty())
{
cout<<st.top()<<endl ;
st.pop();
}
stack এর header file হল : #include<stack>
উদাহরণ :
0 comments: (+add yours?)
Post a Comment