Advertisement
Roctik

Untitled

Dec 30th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <stack>
  3. #include <string.h>
  4. using namespace std;
  5.  
  6. struct Film{
  7.     string title;
  8.     int count;
  9.     int year;
  10. };
  11.  
  12. int main(){
  13.     Film film;
  14.     string title;
  15.     int count;
  16.     int year;
  17.     stack<Film> filmStack;
  18.     stack<Film> last;
  19.    
  20.     int i = 0;
  21.     while (i != 5) {
  22.         cout<<"Input title:";
  23.         cin>>film.title;
  24.         cout<<"Input count:";
  25.         cin>>film.count;
  26.         cout<<"Input year:";
  27.         cin>>film.year;
  28.        
  29.         filmStack.push(film);
  30.         i++;
  31.         cout<<endl;
  32.   }
  33.  
  34.   i=0;
  35.   while (i != 3) {
  36.         last.push(filmStack.top());
  37.         filmStack.pop();
  38.         i++;
  39.         cout<<endl;
  40.   }
  41.  
  42.    
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement