-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.cpp
More file actions
49 lines (49 loc) · 1.17 KB
/
stack.cpp
File metadata and controls
49 lines (49 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//#include "Stack.h"
//#include<iostream>
//using namespace std;
//int main()
//{
// // Stack s;
// //cout<<boolalpha<<"s empty?"<<s.empty()<<endl;
// ///*for(int i=1;i<=128;i++)
// // s.push(i);
// //cout<<"Stack should be full now\n";
// //s.push(129);*/
// //for(int i=1;i<=4;i++)
// // s.push(2*i);
// //cout<<"Stack contents:"<<endl;
// //s.display(cout);
// //cout<<"s empty?"<<s.empty()<<endl;
// //cerr<<"top value: "<<s.top()<<endl;
// //while(!s.empty())
// //{
// // cout<<"Popping "<<s.top()<<endl;
// // s.pop();
// //}
// //cout<<"s.empty?"<<s.empty()<<endl;
// unsigned number,
// remainder;
// Stack stackOfRemainders;
// char response;
// do
// {
// cout<<"endter positive integer to convert:";
// cin>>number;
// while(number!=0)
// {
// remainder=number&2;
// stackOfRemainders.push(remainder);
// number/=2;
// }
// cout<<"base-two representation:";
// while(!stackOfRemainders.empty())
// {
// remainder=stackOfRemainders.top();
// stackOfRemainders.pop();
// cout<<remainder;
// }
// cout<<endl;
// cout<<"\nMore (Y or N)?";
// cin>>response;
// }while( response=='y'||response=='Y');
//}