Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stack>
- #include <string.h>
- using namespace std;
- struct Film{
- string title;
- int count;
- int year;
- };
- int main(){
- Film film;
- string title;
- int count;
- int year;
- stack<Film> filmStack;
- stack<Film> last;
- int i = 0;
- while (i != 5) {
- cout<<"Input title:";
- cin>>film.title;
- cout<<"Input count:";
- cin>>film.count;
- cout<<"Input year:";
- cin>>film.year;
- filmStack.push(film);
- i++;
- cout<<endl;
- }
- i=0;
- while (i != 3) {
- last.push(filmStack.top());
- filmStack.pop();
- i++;
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement