MCPcopy Create free account
hub / github.com/Lakhankumawat/LearnCPP / main

Function main

S-Stack/twoStackArray.cpp:95–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95int main(){
96 int ch, data;
97
98 while(true){
99
100 cout << "\n1. Push into stack(1) 2. Push into stack(2) 3. Pop from stack(1) 4. Pop from stack(2) 5. Display stack(1) 6. Display stack(2) 7. EXIT" << endl;
101 cout << "Enter your choice " ;
102 cin >> ch;
103
104 switch(ch){
105 case 1: cout << "Enter the data to push : ";
106 cin >> data;
107 push_1(data);
108 display_1();
109 break;
110
111 case 2: cout << "Enter the data to push : ";
112 cin >> data;
113 push_2(data);
114 display_2();
115 break;
116
117 case 3: data = pop_1();
118 if(data != -1)
119 cout << "Popped data is : " << data << endl;
120 display_1();
121 break;
122
123 case 4: data = pop_2();
124 if(data != -1)
125 cout << "Popped data is : " << data << endl;
126 display_2();
127 break;
128
129 case 5: display_1();
130 break;
131
132 case 6: display_2();
133 break;
134
135 case 7: exit(0);
136 }
137 }
138 return 0;
139
140}

Callers

nothing calls this directly

Calls 6

push_1Function · 0.85
display_1Function · 0.85
push_2Function · 0.85
display_2Function · 0.85
pop_1Function · 0.85
pop_2Function · 0.85

Tested by

no test coverage detected