@@ -27,7 +27,7 @@ void insert(int x) {
27
27
28
28
void remove (int x) {
29
29
if (start == NULL ) {
30
- cout << " \n Linked List is empty\n " ;
30
+ std:: cout << " \n Linked List is empty\n " ;
31
31
return ;
32
32
} else if (start->val == x) {
33
33
node *temp = start;
@@ -44,7 +44,7 @@ void remove(int x) {
44
44
}
45
45
46
46
if (temp == NULL ) {
47
- cout << endl << x << " not found in list\n " ;
47
+ std:: cout << endl << x << " not found in list\n " ;
48
48
return ;
49
49
}
50
50
@@ -57,21 +57,21 @@ void search(int x) {
57
57
int found = 0 ;
58
58
while (t != NULL ) {
59
59
if (t->val == x) {
60
- cout << " \n Found" ;
60
+ std:: cout << " \n Found" ;
61
61
found = 1 ;
62
62
break ;
63
63
}
64
64
t = t->next ;
65
65
}
66
66
if (found == 0 ) {
67
- cout << " \n Not Found" ;
67
+ std:: cout << " \n Not Found" ;
68
68
}
69
69
}
70
70
71
71
void show () {
72
72
node *t = start;
73
73
while (t != NULL ) {
74
- cout << t->val << " \t " ;
74
+ std:: cout << t->val << " \t " ;
75
75
t = t->next ;
76
76
}
77
77
}
@@ -89,46 +89,46 @@ void reverse() {
89
89
start->next = NULL ;
90
90
start = first;
91
91
} else {
92
- cout << " \n Empty list" ;
92
+ std:: cout << " \n Empty list" ;
93
93
}
94
94
}
95
95
96
96
int main () {
97
97
int choice, x;
98
98
do {
99
- cout << " \n 1. Insert" ;
100
- cout << " \n 2. Delete" ;
101
- cout << " \n 3. Search" ;
102
- cout << " \n 4. Print" ;
103
- cout << " \n 5. Reverse" ;
104
- cout << " \n 0. Exit" ;
105
- cout << " \n\n Enter you choice : " ;
106
- cin >> choice;
99
+ std:: cout << " \n 1. Insert" ;
100
+ std:: cout << " \n 2. Delete" ;
101
+ std:: cout << " \n 3. Search" ;
102
+ std:: cout << " \n 4. Print" ;
103
+ std:: cout << " \n 5. Reverse" ;
104
+ std:: cout << " \n 0. Exit" ;
105
+ std:: cout << " \n\n Enter you choice : " ;
106
+ std:: cin >> choice;
107
107
switch (choice) {
108
108
case 1 :
109
- cout << " \n Enter the element to be inserted : " ;
110
- cin >> x;
109
+ std:: cout << " \n Enter the element to be inserted : " ;
110
+ std:: cin >> x;
111
111
insert (x);
112
112
break ;
113
113
case 2 :
114
- cout << " \n Enter the element to be removed : " ;
115
- cin >> x;
114
+ std:: cout << " \n Enter the element to be removed : " ;
115
+ std:: cin >> x;
116
116
remove (x);
117
117
break ;
118
118
case 3 :
119
- cout << " \n Enter the element to be searched : " ;
120
- cin >> x;
119
+ std:: cout << " \n Enter the element to be searched : " ;
120
+ std:: cin >> x;
121
121
search (x);
122
122
break ;
123
123
case 4 :
124
124
show ();
125
- cout << " \n " ;
125
+ std:: cout << " \n " ;
126
126
break ;
127
127
case 5 :
128
- cout << " The reversed list: \n " ;
128
+ std:: cout << " The reversed list: \n " ;
129
129
reverse ();
130
130
show ();
131
- cout << " \n " ;
131
+ std:: cout << " \n " ;
132
132
break ;
133
133
}
134
134
} while (choice != 0 );
0 commit comments