1 | #include <fstream.hfa> |
---|
2 | |
---|
3 | struct S { int i, j; }; |
---|
4 | void ?{}( S & s ) { s.[i, j] = 0; } |
---|
5 | void ?{}( S & s, int i ) { s.[i, j] = [i, 0]; } |
---|
6 | void ?{}( S & s, int i, int j ) { s.[i, j] = [i, j]; } |
---|
7 | void ?{}( S & s, zero_t ) { s.[i, j] = 0; } |
---|
8 | void ?{}( S & s, one_t ) { s.[i, j] = 1; } |
---|
9 | int ?<?( S t1, S t2 ) { return t1.i < t2.i && t1.j < t2.j; } |
---|
10 | int ?<=?( S t1, S t2 ) { return t1.i <= t2.i && t1.j <= t2.j; } |
---|
11 | int ?>?( S t1, S t2 ) { return t1.i > t2.i && t1.j > t2.j; } |
---|
12 | int ?>=?( S t1, S t2 ) { return t1.i >= t2.i && t1.j >= t2.j; } |
---|
13 | S ?=?( S & t1, S t2 ) { t1.i = t2.i; t1.j = t2.j; return t1; } |
---|
14 | S ?+=?( S & t1, S t2 ) { t1.i += t2.i; t1.j += t2.j; return t1; } |
---|
15 | S ?+=?( S & t, one_t ) { t.i += 1; t.j += 1; return t; } |
---|
16 | S ?-=?( S & t1, S t2 ) { t1.i -= t2.i; t1.j -= t2.j; return t1; } |
---|
17 | S ?-=?( S & t, one_t ) { t.i -= 1; t.j -= 1; return t; } |
---|
18 | ofstream & ?|?( ofstream & os, S v ) { return os | '(' | v.i | v.j | ')'; } |
---|
19 | void & ?|?( ofstream & os, S v ) { (ofstream &)(os | v); ends( os ); } |
---|
20 | |
---|
21 | int main() { |
---|
22 | sout | nlOff; // turn off auto newline |
---|
23 | while () { sout | "empty"; break; } else { sout | "else"; } sout | nl; |
---|
24 | do { sout | "empty"; break; } while () else { sout | "else"; } sout | nl; |
---|
25 | for () { sout | "empty"; break; } else { sout | "else"; } sout | nl | nl; |
---|
26 | |
---|
27 | do { sout | "false"; } while (false) else { sout | "else"; } sout | nl | nl; |
---|
28 | |
---|
29 | for ( 0 ) { sout | "A"; } else { sout | "else"; } sout | "zero" | nl; |
---|
30 | for ( 1 ) { sout | "A"; } else { sout | "else"; } sout | nl; |
---|
31 | for ( 10 ) { sout | "A"; } else { sout | "else"; } sout | nl; |
---|
32 | for ( = 10 ) { sout | "A"; } else { sout | "else"; } sout | nl; |
---|
33 | for ( 1 ~= 10 ~ 2 ) { sout | "B"; } else { sout | "else"; } sout | nl; |
---|
34 | for ( 10 -~= 1 ~ 2 ) { sout | "C"; } else { sout | "else"; } sout | nl; |
---|
35 | for ( 0.5 ~ 5.5 ) { sout | "D"; } else { sout | "else"; } sout | nl; |
---|
36 | for ( 5.5 -~ 0.5 ) { sout | "E"; } else { sout | "else"; } sout | nl | nl; |
---|
37 | |
---|
38 | for ( i; 10 ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
39 | for ( i; = 10 ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
40 | for ( i; 1 ~= 10 ~ 2 ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
41 | for ( i; 10 -~= 1 ~ 2 ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
42 | for ( i; 0.5 ~ 5.5 ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
43 | for ( i; 5.5 -~ 0.5 ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
44 | for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; } else { sout | "else"; } sout | nl; |
---|
45 | for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; } else { sout | "else"; } sout | nl | nl; |
---|
46 | |
---|
47 | // @ means do nothing |
---|
48 | for ( i; 1 ~ @ ) { |
---|
49 | if ( i > 10 ) break; |
---|
50 | sout | i; |
---|
51 | } else { sout | "else"; } sout | nl; |
---|
52 | for ( i; 10 -~ @ ) { |
---|
53 | if ( i < 0 ) break; |
---|
54 | sout | i; |
---|
55 | } else { sout | "else"; } sout | nl; |
---|
56 | for ( i; 2 ~ @ ~ 2 ) { |
---|
57 | if ( i > 10 ) break; |
---|
58 | sout | i; |
---|
59 | } else { sout | "else"; } sout | nl; |
---|
60 | for ( i; 2.1 ~ @ ~ @ ) { |
---|
61 | if ( i > 10.5 ) break; |
---|
62 | sout | i; |
---|
63 | i += 1.7; |
---|
64 | } else { sout | "else"; } sout | nl; |
---|
65 | for ( i; 10 -~ @ ~ 2 ) { |
---|
66 | if ( i < 0 ) break; |
---|
67 | sout | i; |
---|
68 | } else { sout | "else"; } sout | nl; |
---|
69 | for ( i; 12.1 ~ @ ~ @ ) { |
---|
70 | if ( i < 2.5 ) break; |
---|
71 | sout | i; |
---|
72 | i -= 1.7; |
---|
73 | } else { sout | "else"; } sout | nl | nl; |
---|
74 | |
---|
75 | enum { N = 10 }; |
---|
76 | for ( N ) { sout | "N"; } else { sout | "else"; } sout | nl; |
---|
77 | for ( i; N ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
78 | for ( i; = N ) { sout | i; } else { sout | "else"; } sout | nl; |
---|
79 | for ( i; N -~ 0 ) { sout | i; } else { sout | "else"; } sout | nl | nl; |
---|
80 | |
---|
81 | const int start = 3, comp = 10, inc = 2; |
---|
82 | for ( i; start ~ comp ~ inc + 1 ) { sout | i; } else { sout | "else"; } sout | nl | nl; |
---|
83 | |
---|
84 | for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
85 | for ( s; (S){10,10} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
86 | sout | nl; |
---|
87 | for ( s; (S){0} ~ (S){10,10} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
88 | for ( s; (S){0} ~ (S){10,10} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
89 | for ( s; (S){0} ~= (S){10,10} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
90 | for ( s; (S){0} ~= (S){10,10} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
91 | sout | nl; |
---|
92 | for ( s; (S){10,10} -~ (S){0} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
93 | for ( s; (S){10,10} -~ (S){0} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
94 | for ( s; (S){10,10} -~= (S){0} ) { sout | s; } else { sout | "else"; } sout | nl; |
---|
95 | for ( s; (S){10,10} -~= (S){0} ~ (S){1} ) { sout | s; } else { sout | "else"; } sout | nl | nl; |
---|
96 | |
---|
97 | for ( i; 10 : j; -5 ~ @ ) { sout | i | j; } else { sout | "else"; } sout | nl; |
---|
98 | for ( i; 10 : j; -5 -~ @ ) { sout | i | j; } else { sout | "else"; } sout | nl; |
---|
99 | for ( i; 10 : j; -5 ~ @ ~ 2 ) { sout | i | j; } else { sout | "else"; } sout | nl; |
---|
100 | for ( i; 10 : j; -5 -~ @ ~ 2 ) { sout | i | j; } else { sout | "else"; } sout | nl | nl; |
---|
101 | |
---|
102 | for ( j; -5 ~ @ : i; 10 ) { sout | i | j; } else { sout | "else"; } sout | nl; |
---|
103 | for ( j; -5 -~ @ : i; 10 ) { sout | i | j; } else { sout | "else"; } sout | nl; |
---|
104 | for ( j; -5 ~ @ ~ 2 : i; 10 ) { sout | i | j; } else { sout | "else"; } sout | nl; |
---|
105 | for ( j; -5 -~ @ ~ 2 : i; 10 ) { sout | i | j; } else { sout | "else"; } sout | nl | nl; |
---|
106 | |
---|
107 | for ( j; -5 -~ @ ~ 2 : i; 10 : k; 1.5 ~ @ ) { sout | i | j | k; } else { sout | "else"; } sout | nl; |
---|
108 | for ( j; -5 -~ @ ~ 2 : k; 1.5 ~ @ : i; 10 ) { sout | i | j | k; } else { sout | "else"; } sout | nl; |
---|
109 | for ( k; 1.5 ~ @ : j; -5 -~ @ ~ 2 : i; 10 ) { sout | i | j | k; } else { sout | "else"; } sout | nl; |
---|
110 | } |
---|