-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
86 lines (66 loc) · 1.57 KB
/
Copy pathutils.h
File metadata and controls
86 lines (66 loc) · 1.57 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef UTILS_H
#define UTILS_H
#include <string>
using std::string;
namespace MyExcel
{
class Vector
{
string *data;
int capacity;
int length;
public:
// 생성자
Vector(int n = 1);
// 맨 뒤에 새로운 원소를 추가한다.
void push_back(string s);
// 임의의 위치의 원소에 접근한다.
string operator[](int i);
// x 번째 위치한 원소를 제거한다.
void remove(int x);
// 현재 벡터의 크기를 구한다.
int size();
~Vector();
};
class Stack
{
struct Node
{
Node *prev;
string s;
Node(Node *prev, string s) : prev(prev), s(s) {}
};
Node *current;
Node start;
public:
Stack();
// 최상단에 새로운 원소를 추가한다.
void push(string s);
// 최상단의 원소를 제거하고 반환한다.
string pop();
// 최상단의 원소를 반환한다. (제거 안함)
string peek();
// 스택이 비어있는지의 유무를 반환한다.
bool is_empty();
~Stack();
};
class NumStack
{
struct Node
{
Node *prev;
double s;
Node(Node *prev, double s) : prev(prev), s(s) {}
};
Node *current;
Node start;
public:
NumStack();
void push(double s);
double pop();
double peek();
bool is_empty();
~NumStack();
};
}
#endif