| r1642 vs r1643 | ||
|---|---|---|
| 1 | 1 | [[분류:냥]] |
| 2 | {{{#!wiki style="font-weight: 300; font-size: 20px" | |
| 3 | {{{#!if 식 = '11+2' | |
| 4 | @식=11+2@}}} = {{{#!if s1=false, s2=false, s3=false, j=1+0, i=0+0, k=1+0 | |
| 5 | ##switch1 : 숫자 계속 탐색하기, switch2 : 소수점 아래 기입하기. switch3 : 중복 실행 방지. | |
| 6 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 7 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 8 | ##숫자를 발견할 경우 | |
| 9 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 10 | ##여기에 앞자리가 음수냐 아니냐를 읽는 판별을 만들어야 합니다. ㅏ 이걸 생각 못했네요 그럼 좀 많이 길어지는데 | |
| 11 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 12 | ##숫자를 계속 발견할 경우 (소수점일 수도 있습니다. 여기서는 숫자일 경우) | |
| 13 | ##여기에서 소수점 위를 기입하냐 소수점 아래를 기입하냐 소수점 아래라면 소수점 아래 몇번째 자리를 기입하느냐를 적어야 합니다. | |
| 14 | {{{#!if s2==false | |
| 15 | ##정수 자리를 기입하는 경우 | |
| 16 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 17 | }}}}}}{{{#!if s2==true | |
| 18 | ##소수점 아래 자리를 기입하는 경우 | |
| 19 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true | |
| 20 | }}}{{{#!if k+=1 | |
| 21 | ##다음 소수점 자리 찾기 | |
| 22 | }}}}}}}}}{{{#!if (s1==true)&&(s2==false)&&(식[i]==46)&&(s3==false) | |
| 23 | ##앞에서 숫자를 발견한 다음 소수점을 발견할 경우 (소수점 발견은 최초 1회에 한함) | |
| 24 | {{{#!if s2=true, s3=true, k=1+0 | |
| 25 | ##switch2 : 켜기 | |
| 26 | }}}}}}{{{#!if (s1==true)&&(((s2==false)&&!this['d'+i]&&(식[i]!=46))||((s2==true)&&!this['d'+i]))&&(s3==false) | |
| 27 | ##숫자가 더 이상 나오지 않고 소수점을 발견하지 못했을 경우, 소수점을 발견한 상황인데 숫자가 나오지 않을 경우 (소수점이 다시 나오는 경우가 자동적으로 포함) | |
| 28 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 29 | ##소수점 아래 기입하는 스위치도 off, 다음 index(j) 매김. | |
| 30 | }}}{{{#!if s3==true | |
| 31 | ##여기까지 과정을 거쳤다면 스위치 off. | |
| 32 | {{{#!if s3=false | |
| 33 | }}}}}} | |
| 34 | }}}{{{#!if i+=1 | |
| 35 | }}} | |
| 36 | ## | |
| 37 | {{{#!if false | |
| 38 | ##이 if문은 실행되지 않는 단락. 주석만 제거하고 복사 붙여넣기. | |
| 39 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 40 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 41 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 42 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 43 | {{{#!if s2==false | |
| 44 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 45 | }}}}}}{{{#!if s2==true | |
| 46 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true | |
| 47 | }}}{{{#!if k+=1 | |
| 48 | }}}}}}}}}{{{#!if (s1==true)&&(s2==false)&&(식[i]==46)&&(s3==false) | |
| 49 | {{{#!if s2=true, s3=true, k=1+0 | |
| 50 | }}}}}}{{{#!if (s1==true)&&(((s2==false)&&!this['d'+i]&&(식[i]!=46)||(s2==false))||((s2==true)&&!this['d'+i]&&(식=[i]==46)))&&(s3==false) | |
| 51 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 52 | }}}{{{#!if s3==true | |
| 53 | {{{#!if s3=false | |
| 54 | }}}}}} | |
| 55 | }}}{{{#!if i+=1 | |
| 56 | }}} | |
| 57 | #### | |
| 58 | }}} | |
| 59 | ## | |
| 60 | {{{#!if this['v1'] == 1 | |
| 61 | this['v1'] == 1}}} | |
| 62 | ## | |
| 63 | {{{#!if s3=false | |
| 64 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 65 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 66 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 67 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 68 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 69 | }}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) | |
| 70 | {{{#!if s2=true, s3=true | |
| 71 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) | |
| 72 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 73 | }}}}}}{{{#!if i+=1 | |
| 74 | }}} | |
| 75 | ## | |
| 76 | {{{#!if this['v1'] == 11 | |
| 77 | this['v1'] == 11}}} | |
| 78 | ## | |
| 79 | {{{#!if s3=false | |
| 80 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 81 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 82 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 83 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 84 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 85 | }}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) | |
| 86 | {{{#!if s2=true, s3=true | |
| 87 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) | |
| 88 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 89 | }}}}}}{{{#!if i+=1 | |
| 90 | }}}{{{#!if s3=false | |
| 91 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 92 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 93 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 94 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 95 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 96 | }}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) | |
| 97 | {{{#!if s2=true, s3=true | |
| 98 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) | |
| 99 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 100 | }}}}}}{{{#!if i+=1 | |
| 101 | }}} | |
| 102 | ## | |
| 103 | {{{#!if this['v2'] == 2 | |
| 104 | this['v2'] == 2}}} | |
| 105 | ## | |
| 106 | ## | |
| 107 | ## | |
| 108 | ## | |
| 109 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57), i+=1 | |
| 110 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57), i+=1 | |
| 111 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57), i+=1 | |
| 112 | }}} | |
| 113 | ## 식 검증이 됐다 치면 | |
| 114 | ## dn : true - 수 / false - 연산자 | |
| 115 | {{{#!if this['d0'] | |
| 116 | 1}}}{{{#!if this['d1'] | |
| 117 | 1}}}{{{#!if !this['d2'] | |
| 118 | +}}}{{{#!if this['d3'] | |
| 119 | 2}}} | |
| 120 | ## in : 11+2 에서 '11'은 0번째 위치, '+'는 2번째 위치.. > 0, 2, 3 > 위치 기억 / 뺄셈으로 자릿수 계산 | |
| 121 | ## 보다 좋은 방법이 있ㅅ을 것 같은데음ㅁ.. | |
| 122 | {{{#!if i = 1, j = 1, i0 = 0 | |
| 123 | }}} | |
| 124 | {{{#!if t = this['d0'] != this['d1'], t | |
| 125 | {{{#!if this['i'+i] = j, j+=1, i+=1 | |
| 126 | }}}}}}{{{#!if !t | |
| 127 | {{{#!if j+=1 | |
| 128 | }}}}}}{{{#!if t = this['d1'] != this['d2'], t | |
| 129 | {{{#!if this['i'+i] = j, j+=1, i+=1 | |
| 130 | }}}}}}{{{#!if !t | |
| 131 | {{{#!if j+=1 | |
| 132 | }}}}}}{{{#!if t = this['d1'] != this['d2'], t | |
| 133 | {{{#!if this['i'+i] = j, j+=1, i+=1 | |
| 134 | }}}}}}{{{#!if !t | |
| 135 | {{{#!if j+=1 | |
| 136 | }}}}}} | |
| 137 | ## {{{#!if i0 == 0 | |
| 138 | ## i0 == 0 }}}{{{#!if i1 == 2 | |
| 139 | ## i1 == 2 }}}{{{#!if i2 == 3 | |
| 140 | ## i2 == 3 }}} | |
| 141 | ## {{{#!if list = [d0, d1, d2, d3] | |
| 142 | ## }}} | |
| 143 | }}} | |
| 144 | ##생각해보니까 그냥 r을 지정할 수도 있겠구나 | |
| 145 | ## [include(틀:계산기, r=13)] | |
| 146 | ## [include(틀:계산기, a=123456789, f=+, b=1)] | |
| 147 | ## [include(틀:계산기, a=123456789, f=-, b=1)] | |
| 148 | ## [include(틀:계산기, a=123459, f=*, b=2)] | |
| 149 | ## [include(틀:계산기, a=123459, f=/, b=2)] | |
| 2 | == 문단 == | |
| 3 | ################################################################################################## | |
| 150 | 4 | [include(틀:계산기2, a=10, f=/, b=3)] |
| 151 | 5 | [include(틀:계산기2, a=-5, f=/, b=200)] |
| 152 | 6 | [include(틀:계산기2, a=-5, f=*, b=200)] |
| ... | ... | |
| 172 | 26 | [[냥#ㅁㄴㅇㄹ|냥#ㅁㄴㅇㄹ]] < 볼드체아님 |
| 173 | 27 | [[문서:냥]] < 볼드체아님 |
| 174 | 28 | |
| 29 | [include(틀:계산기, r=13)] | |
| 30 | \[include(틀:계산기, r=13)] | |
| 31 | 생각해보니까 그냥 r을 지정할 수도 있겠구나 | |
| 32 | [include(틀:계산기, a=123456789, f=+, b=1)] | |
| 33 | [include(틀:계산기, a=123456789, f=-, b=1)] | |
| 34 | [include(틀:계산기, a=123459, f=*, b=2)] | |
| 35 | [include(틀:계산기, a=123459, f=/, b=2)] | |
| 36 | ||
| 175 | 37 | == ㅁㄴㅇㄹ == |
| 176 | 38 | [include(a)]''''''[include(a)][include(a)] |
| 177 | 39 | [[]][include(a)][include(a)][include(a)] |
| ... | ... | |
| 222 | 84 | [include(틀:ㅁ, str=Hello\, World!)] |
| 223 | 85 | toString() 가능 |
| 224 | 86 | parseInt() x |
| 87 | ||
| 88 | == == | |
| 89 | {{{#!wiki style="font-weight: 300; font-size: 20px" | |
| 90 | {{{#!if 식 = '11+2' | |
| 91 | @식=11+2@}}} = {{{#!if s1=false, s2=false, s3=false, j=1+0, i=0+0, k=1+0 | |
| 92 | ##switch1 : 숫자 계속 탐색하기, switch2 : 소수점 아래 기입하기. switch3 : 중복 실행 방지. | |
| 93 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 94 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 95 | ##숫자를 발견할 경우 | |
| 96 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 97 | ##여기에 앞자리가 음수냐 아니냐를 읽는 판별을 만들어야 합니다. ㅏ 이걸 생각 못했네요 그럼 좀 많이 길어지는데 | |
| 98 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 99 | ##숫자를 계속 발견할 경우 (소수점일 수도 있습니다. 여기서는 숫자일 경우) | |
| 100 | ##여기에서 소수점 위를 기입하냐 소수점 아래를 기입하냐 소수점 아래라면 소수점 아래 몇번째 자리를 기입하느냐를 적어야 합니다. | |
| 101 | {{{#!if s2==false | |
| 102 | ##정수 자리를 기입하는 경우 | |
| 103 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 104 | }}}}}}{{{#!if s2==true | |
| 105 | ##소수점 아래 자리를 기입하는 경우 | |
| 106 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true | |
| 107 | }}}{{{#!if k+=1 | |
| 108 | ##다음 소수점 자리 찾기 | |
| 109 | }}}}}}}}}{{{#!if (s1==true)&&(s2==false)&&(식[i]==46)&&(s3==false) | |
| 110 | ##앞에서 숫자를 발견한 다음 소수점을 발견할 경우 (소수점 발견은 최초 1회에 한함) | |
| 111 | {{{#!if s2=true, s3=true, k=1+0 | |
| 112 | ##switch2 : 켜기 | |
| 113 | }}}}}}{{{#!if (s1==true)&&(((s2==false)&&!this['d'+i]&&(식[i]!=46))||((s2==true)&&!this['d'+i]))&&(s3==false) | |
| 114 | ##숫자가 더 이상 나오지 않고 소수점을 발견하지 못했을 경우, 소수점을 발견한 상황인데 숫자가 나오지 않을 경우 (소수점이 다시 나오는 경우가 자동적으로 포함) | |
| 115 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 116 | ##소수점 아래 기입하는 스위치도 off, 다음 index(j) 매김. | |
| 117 | }}}{{{#!if s3==true | |
| 118 | ##여기까지 과정을 거쳤다면 스위치 off. | |
| 119 | {{{#!if s3=false | |
| 120 | }}}}}} | |
| 121 | }}}{{{#!if i+=1 | |
| 122 | }}} | |
| 123 | ## | |
| 124 | {{{#!if false | |
| 125 | ##이 if문은 실행되지 않는 단락. 주석만 제거하고 복사 붙여넣기. | |
| 126 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 127 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 128 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 129 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 130 | {{{#!if s2==false | |
| 131 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 132 | }}}}}}{{{#!if s2==true | |
| 133 | {{{#!if this['v'+j] = this['v'+j]+(10.0**(-k))*(+(식.substr(i,1))), s3=true | |
| 134 | }}}{{{#!if k+=1 | |
| 135 | }}}}}}}}}{{{#!if (s1==true)&&(s2==false)&&(식[i]==46)&&(s3==false) | |
| 136 | {{{#!if s2=true, s3=true, k=1+0 | |
| 137 | }}}}}}{{{#!if (s1==true)&&(((s2==false)&&!this['d'+i]&&(식[i]!=46)||(s2==false))||((s2==true)&&!this['d'+i]&&(식=[i]==46)))&&(s3==false) | |
| 138 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 139 | }}}{{{#!if s3==true | |
| 140 | {{{#!if s3=false | |
| 141 | }}}}}} | |
| 142 | }}}{{{#!if i+=1 | |
| 143 | }}} | |
| 144 | #### | |
| 145 | }}} | |
| 146 | ## | |
| 147 | {{{#!if this['v1'] == 1 | |
| 148 | this['v1'] == 1}}} | |
| 149 | ## | |
| 150 | {{{#!if s3=false | |
| 151 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 152 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 153 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 154 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 155 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 156 | }}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) | |
| 157 | {{{#!if s2=true, s3=true | |
| 158 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) | |
| 159 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 160 | }}}}}}{{{#!if i+=1 | |
| 161 | }}} | |
| 162 | ## | |
| 163 | {{{#!if this['v1'] == 11 | |
| 164 | this['v1'] == 11}}} | |
| 165 | ## | |
| 166 | {{{#!if s3=false | |
| 167 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 168 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 169 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 170 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 171 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 172 | }}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) | |
| 173 | {{{#!if s2=true, s3=true | |
| 174 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) | |
| 175 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 176 | }}}}}}{{{#!if i+=1 | |
| 177 | }}}{{{#!if s3=false | |
| 178 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57) | |
| 179 | }}}{{{#!if (s1==false)&&this['d'+i]&&(s3==false) | |
| 180 | {{{#!if this['v'+j] = +(식.substr(i,1)), s1=true, s3=true | |
| 181 | }}}}}}{{{#!if (s1==true)&&this['d'+i]&&(s3==false) | |
| 182 | {{{#!if this['v'+j] = 10*this['v'+j]+(+(식.substr(i,1))), s3=true | |
| 183 | }}}}}}{{{#!if (s1==true)&&(식[i]==46)&&(s3==false) | |
| 184 | {{{#!if s2=true, s3=true | |
| 185 | }}}}}}{{{#!if (s1==true)&&!this['d'+i]&&(s3==false) | |
| 186 | {{{#!if j+=1, s1=false, s2=false, s3=true | |
| 187 | }}}}}}{{{#!if i+=1 | |
| 188 | }}} | |
| 189 | ## | |
| 190 | {{{#!if this['v2'] == 2 | |
| 191 | this['v2'] == 2}}} | |
| 192 | ## | |
| 193 | ## | |
| 194 | ## | |
| 195 | ## | |
| 196 | {{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57), i+=1 | |
| 197 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57), i+=1 | |
| 198 | }}}{{{#!if this['d'+i] = (식[i]>=48&&식[i]<=57), i+=1 | |
| 199 | }}} | |
| 200 | ## 식 검증이 됐다 치면 | |
| 201 | ## dn : true - 수 / false - 연산자 | |
| 202 | {{{#!if this['d0'] | |
| 203 | 1}}}{{{#!if this['d1'] | |
| 204 | 1}}}{{{#!if !this['d2'] | |
| 205 | +}}}{{{#!if this['d3'] | |
| 206 | 2}}} | |
| 207 | ## in : 11+2 에서 '11'은 0번째 위치, '+'는 2번째 위치.. > 0, 2, 3 > 위치 기억 / 뺄셈으로 자릿수 계산 | |
| 208 | ## 보다 좋은 방법이 있ㅅ을 것 같은데음ㅁ.. | |
| 209 | {{{#!if i = 1, j = 1, i0 = 0 | |
| 210 | }}} | |
| 211 | {{{#!if t = this['d0'] != this['d1'], t | |
| 212 | {{{#!if this['i'+i] = j, j+=1, i+=1 | |
| 213 | }}}}}}{{{#!if !t | |
| 214 | {{{#!if j+=1 | |
| 215 | }}}}}}{{{#!if t = this['d1'] != this['d2'], t | |
| 216 | {{{#!if this['i'+i] = j, j+=1, i+=1 | |
| 217 | }}}}}}{{{#!if !t | |
| 218 | {{{#!if j+=1 | |
| 219 | }}}}}}{{{#!if t = this['d1'] != this['d2'], t | |
| 220 | {{{#!if this['i'+i] = j, j+=1, i+=1 | |
| 221 | }}}}}}{{{#!if !t | |
| 222 | {{{#!if j+=1 | |
| 223 | }}}}}} | |
| 224 | ## {{{#!if i0 == 0 | |
| 225 | ## i0 == 0 }}}{{{#!if i1 == 2 | |
| 226 | ## i1 == 2 }}}{{{#!if i2 == 3 | |
| 227 | ## i2 == 3 }}} | |
| 228 | ## {{{#!if list = [d0, d1, d2, d3] | |
| 229 | ## }}} | |
| 230 | }}} |