![]() |
| ||
| Linked stack modification issue I need to have my code modified, but am unsure how to write the code to do it. After the ID and name are poped from the stack, I need the program to automatically display the list created i.e. I don't want to use display as an option. I think I need to have main function loop back after pop and display are done. How can I do this? Here is the code: #include<conio.h>Code tags added. -Narue |
| ||
| Re: Linked stack modification issue Use code tags for any future code. I've added them for you this time, but next time I may just feel the need to delete your post if you fail to do it properly. >After the ID and name are poped from the stack, I need the program to >automatically display the list created Change this: case 2: obj.pop();To this: case 2: obj.pop();By default, cases will fall through to the next case if you don't use a break statement. So if you want to display the stack after every pop, simply omit the break on the pop case. If that's not what you want, be more specific. |
| ||
| Re: Linked stack modification issue More specifically, how can I get rid of display () and still "display" poped entries after each pop. Thanks. |
| ||
| Re: Linked stack modification issue >More specifically, how can I get rid of display () and still "display" poped entries after each pop. That's easy: you don't. Since the data members of your class are private (as they should be), the only way to display them is with a public member function or a friend function. Either way you would have the equivalent of link_stack::display(). |
| All times are GMT -4. The time now is 3:34 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC