-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtablefunction.h
More file actions
92 lines (56 loc) · 1.52 KB
/
tablefunction.h
File metadata and controls
92 lines (56 loc) · 1.52 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
87
88
89
90
91
92
#include "position.h"
#include "const.h"
void Fill(int **table, string type, int row, int value);
void Init(int** table);
int** Allocate(int row);
void print(char start,char end);
void print(int start,int end,int** table);
void FillSuccesTable(bool* table,int* success);
void Fill(int **table, string type, int row, int value){
int size=type.length();
for (int r=0;r<size;r++){
table[row][type[r]]=value;
}
}
int** Allocate(int row){
int** temp=new int* [row];//Create a dynamic memory
int** rwalker=temp;//rwalker poit to the same place that temp
for (int i=0;i<row;i++,rwalker++){
*rwalker=new int[SIZE+1];//Create a dynamic memory
}
return temp;
}
void Init(int** table){
for (int r=0;r<ROW;r++){
for (int c=0;c<SIZE;c++){
table[r][c]=-1;
}
}
}
void print(int start,int end,int** table){
for (int r=0;r<ROW;r++){
for (int c=start;c<=end;c++){
cout<<table[r][c]<<" ";
}
cout<<endl<<endl;
}
cout<<endl<<endl;
}
void print(char start,char end){
char symb=start;
while(symb>=start && symb<=end){
cout<<symb<<" ";
symb=symb+1;
}
cout<<endl<<endl;
}
void FillSuccessTable(bool* table,int* success){
for (int i=0;i<ROW;i++){
if (*success==i){
table[i]=true;
success++;
}
else
table[i]=false;
}
}