#include <cstdlib>
#include<iostream.h>
#define maks 5
#include<string.h>
class Stack {
friend ostream& operator<<(ostream&,const Stack&);
public:
Stack();
int penuh(int);
int kosong(int);
void cetak();
void push(char);
char pop();
private:
char A[maks];
int banyak;
};
ostream& operator <<(ostream& out,con
st Stack& s)
{
cout<<"\n Isi stack: ";
for(int i=0;i<s.banyak;i++)
out<<s.A[i]<<" ";
}
Stack::Stack() {
banyak =0;
for(int i=0;i<maks;i++)
A[i]='0';
}
int Stack::penuh (int s) {
return s ==maks ? 1:0; }
int Stack::kosong(int s) {
return s ==0 ? 1:0; }
Senin, 13 Desember 2010
Langganan:
Postingan (Atom)