#include <iostream>
#include<stack>
using namespace std;
int main(){
stack<int>stack1;
stack<int>stack2;
stack<int>stack3;
stack<int>stack4;
stack<int>stack5;
stack<int>stack6;
stack<int>stack7;
stack1.push(1);
cout<<"Length of stack 1: "<<stack1.size()<<endl;
for(int i=2; i<6; i++){
stack2.push(i);
}
cout<<"Length of stack 2: "<<stack2.size()<<endl;
for(int i=7; i<10; i++){
stack3.push(i);
}
cout<<"Length of stack 3: "<<stack3.size()<<endl;
for(int i=2; i<6; i++){
stack4.push(i);
}
cout<<"Length of stack 4: "<<stack4.size()<<endl;
for(int i=1; i<=6; i++){
stack5.push(i);
}
cout<<"Length of stack 5: "<<stack5.size()<<endl;
for(int i=1; i<=6; i++){
stack6.push(i);
}
cout<<"Length of stack 6: "<<stack6.size()<<endl;
for(int i=1; i<3; i++){
stack7.push(i);
}
cout<<"Length of stack 7: "<<stack7.size()<<endl;
int number= stack5.size() + stack2.size() + stack1.size();
cout<<"\n\nYou can infer "<<number<<" cans" <<endl;
}
Comments
Leave a comment