Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. /*
  2.  *  stos.h
  3.  *  Stos
  4.  *
  5.  *  Created by dreame4 on 23/02/2011.
  6.  *  Copyright 2011 __MyCompanyName__. All rights reserved.
  7.  *
  8.  */
  9.  
  10. struct STOS {
  11.     char stos[200];
  12.     int wierzcholek;
  13.    
  14.     void wloz();
  15.     void zdejmij();
  16. };
  17.  
  18. /*
  19.  *  stos.cpp
  20.  *  Stos
  21.  *
  22.  *  Created by dreame4 on 23/02/2011.
  23.  *  Copyright 2011 __MyCompanyName__. All rights reserved.
  24.  *
  25.  */
  26.  
  27. #include <iostream>
  28.  
  29. using namespace std;
  30.  
  31. #include "stos.h"
  32.  
  33. void STOS :: wloz() {
  34.     char c;
  35.     cin >> c;
  36.     stos[wierzcholek] = c;
  37.     wierzcholek++;
  38.    
  39.     cout << "\nDodales " << c << endl;
  40. };
  41.  
  42. void STOS :: zdejmij() {
  43.     char tmp;
  44.     wierzcholek--;
  45.     tmp = stos[wierzcholek];
  46.     cout << "\nZdjalem: " << tmp << endl;
  47. };
  48.  
  49. // main.cpp
  50.  
  51.  
  52. #include <iostream>
  53.  
  54. using namespace std;
  55.  
  56. #include "stos.h"
  57.  
  58. int main (int argc, char * const argv[]) {
  59.     STOS a;
  60.    
  61.     int i = 5;
  62.     while (i--) {
  63.         a.wloz();
  64.     }
  65.    
  66.     i = 2;
  67.     while (i--) {
  68.         a.zdejmij();
  69.     }
  70.    
  71.     return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement