fix: Remove namespace

This commit is contained in:
Panquesito7
2020-06-23 16:37:46 -05:00
parent 48b7773b37
commit cdacbf1998

View File

@@ -1,5 +1,4 @@
#include <iostream> #include <iostream>
using namespace std;
struct node { struct node {
int val; int val;
@@ -17,10 +16,10 @@ void push(int x) {
void pop() { void pop() {
if (top_var == NULL) { if (top_var == NULL) {
cout << "\nUnderflow"; std::cout << "\nUnderflow";
} else { } else {
node *t = top_var; node *t = top_var;
cout << "\n" << t->val << " deleted"; std::cout << "\n" << t->val << " deleted";
top_var = top_var->next; top_var = top_var->next;
delete t; delete t;
} }
@@ -29,7 +28,7 @@ void pop() {
void show() { void show() {
node *t = top_var; node *t = top_var;
while (t != NULL) { while (t != NULL) {
cout << t->val << "\n"; std::cout << t->val << "\n";
t = t->next; t = t->next;
} }
} }
@@ -37,14 +36,14 @@ void show() {
int main() { int main() {
int ch, x; int ch, x;
do { do {
cout << "\n1. Push"; std::cout << "\n1. Push";
cout << "\n2. Pop"; std::cout << "\n2. Pop";
cout << "\n3. Print"; std::cout << "\n3. Print";
cout << "\nEnter Your Choice : "; std::cout << "\nEnter Your Choice : ";
cin >> ch; std::cin >> ch;
if (ch == 1) { if (ch == 1) {
cout << "\nInsert : "; std::cout << "\nInsert : ";
cin >> x; std::cin >> x;
push(x); push(x);
} else if (ch == 2) { } else if (ch == 2) {
pop(); pop();