Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * stos.h
- * Stos
- *
- * Created by dreame4 on 23/02/2011.
- * Copyright 2011 __MyCompanyName__. All rights reserved.
- *
- */
- struct STOS {
- char stos[200];
- int wierzcholek;
- void wloz();
- void zdejmij();
- };
- /*
- * stos.cpp
- * Stos
- *
- * Created by dreame4 on 23/02/2011.
- * Copyright 2011 __MyCompanyName__. All rights reserved.
- *
- */
- #include <iostream>
- using namespace std;
- #include "stos.h"
- void STOS :: wloz() {
- char c;
- cin >> c;
- stos[wierzcholek] = c;
- wierzcholek++;
- cout << "\nDodales " << c << endl;
- };
- void STOS :: zdejmij() {
- char tmp;
- wierzcholek--;
- tmp = stos[wierzcholek];
- cout << "\nZdjalem: " << tmp << endl;
- };
- // main.cpp
- #include <iostream>
- using namespace std;
- #include "stos.h"
- int main (int argc, char * const argv[]) {
- STOS a;
- int i = 5;
- while (i--) {
- a.wloz();
- }
- i = 2;
- while (i--) {
- a.zdejmij();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement