-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoliz.cpp
More file actions
41 lines (32 loc) · 821 Bytes
/
Copy pathPoliz.cpp
File metadata and controls
41 lines (32 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <iostream>
#include "Lex.cpp"
class Poliz {
Lex *p;
int size;
int top;
public:
Poliz ( int max_size ) {
p = new Lex [size = max_size];
top = 0;
};
~Poliz() { delete []p; };
void put_lex(Lex l) { p[top]=l; ++top; };
void put_lex(Lex l, int place) { p[place]=l; };
void blank() { ++top; };
int get_top() { return top; };
Lex& operator[] ( int index ) {
if (index > size)
throw "POLIZ:out of array";
else
if ( index > top )
throw "POLIZ:indefinite element of array";
else
return p[index];
}
void clear() { top = 0; }
void print() {
for ( int i = 0; i < top; ++i )
cout << i << " " << p[i];
}
};