Is there default constructor in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Is there default constructor in this code?

// CPP program to demonstrate working of STL stack #include <iostream> #include <stack> using namespace std; void showstack(stack <int> s) { while (!s.empty()) { cout << '\t' << s.top(); s.pop(); } cout << '\n'; } int main () { stack <int> s; s.push(10); s.push(30); s.push(20); s.push(5); s.push(1); cout << "The stack is : "; showstack(s); cout << "\ns.size() : " << s.size(); cout << "\ns.top() : " << s.top(); cout << "\ns.pop() : "; s.pop(); showstack(s); return 0; }

27th Jan 2019, 9:30 AM
Zhenis Otarbay
Zhenis Otarbay - avatar
2 Answers
+ 5
Is there a destructor in the code?
28th Jan 2019, 2:15 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
+ 5
Do you write names? Ot do you also include something like @ before the name to make a name green?
28th Jan 2019, 2:40 PM
Zhenis Otarbay
Zhenis Otarbay - avatar