-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvanced_program.antro
More file actions
67 lines (49 loc) · 1.09 KB
/
advanced_program.antro
File metadata and controls
67 lines (49 loc) · 1.09 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
module: "advanced_program";
require: "time.antro";
#require: "regex.antro";
def: MAX 500;
begin:
main(void)
# testing this program
var ty = call: factorUpBy2(MAX);
call: print(ty);
export: factorUpBy2, getString ;
end;
# composite[class]: Account(){
# data: int amount ;
# _data: string acctName ;
#
# _method: setAmount(c){
# .amount = c
# }
# }
def: convertToFactor (boolean c, int d) {
var int gb = 23, int kl = 0;
for(var i = 0; i < gb; i = i + 1){
if(c == true){
kl += (i * d) + gb;
}
}
retn kl;
}
def: factorUpBy2 (int x) {
var y, boolean g = true;
if(x > 0){
y = (x / 2) * 4;
}else{
g = false;
}
y = call: convertToFactor(g, x);
retn y;
}
def: getString (int num) {
var array = @{"zero", "one", "two", "three"};
var str = "";
for(var j = 0; j <= num; ++j){
if(j === num){
str = array[j];
break;
}
}
retn str;
};