Why is this showing compilation error? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why is this showing compilation error?

Help me sort this out? https://code.sololearn.com/cIPKR7F2LGFM/?ref=app

7th Oct 2019, 8:34 AM
Piyush Srivastava
Piyush Srivastava - avatar
3 Antworten
+ 2
Seems like sololearn decided to just display "Compilation Error" instead of showing a long chain of errors I saw when I ran it on a different compiler. The main problem is that showstack returns void (nothing).
7th Oct 2019, 8:48 AM
jtrh
jtrh - avatar
+ 3
showstack() returns void, so you are trying to print a nonexisting value when saying cout << showstack(); You should call the function on its own, i.e. cout << "Stack contains:" << endl; showstack( s );
7th Oct 2019, 8:48 AM
Shadow
Shadow - avatar
+ 1
Your code is perfect I think sololearn doesn't provide stack header file that's why it is giving error. I run your code on codeblocks it runs perfect. Your code is perfect just try any other compiler.
7th Oct 2019, 8:51 AM
Chirag Kumar
Chirag Kumar - avatar