Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated version of stack linked list #2036

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

anxkhn
Copy link

@anxkhn anxkhn commented Oct 1, 2022

updated version of stack linked list with proper formatting and fixed print statements.

Description of Change

Checklist

  • Added description of change
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

updated version of stack linked list with proper formatting and fixed print statements.
@mishraabhinn mishraabhinn added the enhancement New feature or request label Oct 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Nov 1, 2022
@Panquesito7 Panquesito7 added Improvement improvement in previously written codes and removed stale Author has not responded to the comments for over 2 weeks enhancement New feature or request labels Jan 2, 2023
@Panquesito7
Copy link
Member

Looks like we might need to use smart pointers instead.

@Panquesito7 Panquesito7 added on hold dont-close This issue/pull request shouldn't be closed labels Jan 9, 2023
@@ -1,64 +1,76 @@
#include <iostream>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <iostream>
#include <iostream> /// for I/O operations

Comment on lines +45 to +73
int main()
{
int ch = 0, x = 0;
do {
do
{
std::cout << "\n0. Exit or Ctrl+C";
std::cout << "\n1. Push";
std::cout << "\n2. Pop";
std::cout << "\n3. Print";
std::cout << "\nEnter Your Choice: ";
std::cin >> ch;
switch (ch) {
case 0:
break;
case 1:
std::cout << "\nInsert : ";
std::cin >> x;
push(x);
break;
case 2:
pop();
break;
case 3:
show();
break;
default:
std::cout << "Invalid option!\n";
break;
switch (ch)
{
case 0:
break;
case 1:
std::cout << "\nInsert : ";
std::cin >> x;
push(x);
break;
case 2:
pop();
break;
case 3:
show();
break;
default:
std::cout << "Invalid option!\n";
break;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use tests

node *t = top_var;
while (t != nullptr) {
while (t != nullptr)
{
std::cout << t->val << "\n";
t = t->next;
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* @brief Main function
* @returns 0 on exit
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dont-close This issue/pull request shouldn't be closed Improvement improvement in previously written codes on hold
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants