56 std::deque<std::string> e_3;
57 std::deque<std::string> e_4;
59 std::deque<std::string> e_3_comb;
60 std::deque<std::string> e_4_comb;
62 std::deque<std::string> e_43_comb;
63 std::deque<std::string> e_34_comb;
65 std::deque<std::string> e_434_comb;
66 std::deque<std::string> e_343_comb;
69 std::deque<std::string> operator_list;
88 "((3.579A5.793)B7.935)",
89 "(3.579A(5.793B7.935))"
92 for (std::size_t i = 0; i <
sizeof(expr) /
sizeof(std::string); ++i)
100 for (std::size_t j = 0; j < operator_list.size(); ++j)
102 std::string curr_expr = expr[i];
103 for (std::size_t k = 0; k <
sizeof(loc)/
sizeof(std::size_t); ++k)
105 curr_expr[loc[k]] = operator_list[j][k];
109 e_3.push_back(curr_expr);
115 std::deque<std::string> operator_list;
126 "((3.579A(yB(zCw))))",
127 "((3.579A((yBz)Cw)))",
128 "((((3.579Ay)Bz)Cw))",
129 "(((3.579A(yBz))Cw))",
131 "((xA(5.793B(zCw))))",
132 "((xA((5.793Bz)Cw)))",
133 "((((xA5.793)Bz)Cw))",
134 "(((xA(5.793Bz))Cw))",
136 "((xA(yB(7.935Cw))))",
137 "((xA((yB7.935)Cw)))",
138 "((((xAy)B7.935)Cw))",
139 "(((xA(yB7.935))Cw))",
141 "((xA(yB(zC9.357))))",
142 "((xA((yBz)C9.357)))",
143 "((((xAy)Bz)C9.357))",
144 "(((xA(yBz))C9.357))",
145 "((3.579A5.793)B(zCw))",
146 "((3.579A(5.793B(zCw))))",
147 "((3.579A((5.793Bz)Cw)))",
148 "((((3.579A5.793)Bz)Cw))",
149 "(((3.579A(5.793Bz))Cw))",
150 "((3.579Ay)B(5.793Cw))",
151 "((3.579A(yB(5.793Cw))))",
152 "((3.579A((yB5.793)Cw)))",
153 "((((3.579Ay)B5.793)Cw))",
154 "(((3.579A(yB5.793))Cw))",
155 "((3.579Ay)B(zC9.357))",
156 "((3.579A(yB(zC9.357))))",
157 "((3.579A((yBz)C9.357)))",
158 "((((3.579Ay)Bz)C9.357))",
159 "(((3.579A(yBz))C9.357))",
160 "((xA5.793)B(7.935Cw))",
161 "((xA(5.793B(7.935Cw))))",
162 "((xA((5.793B7.935)Cw)))",
163 "((((xA5.793)B7.935)Cw))",
164 "(((xA(5.793B7.935))Cw))",
165 "((xA5.793)B(zC9.357))",
166 "((xA(5.793B(zC9.357))))",
167 "((xA((5.793Bz)C9.357)))",
168 "((((xA5.793)Bz)C9.357))",
169 "(((xA(5.793Bz))C9.357))",
170 "((xAy)B(7.935C9.357))",
171 "((xA(yB(7.935C9.357))))",
172 "((xA((yB7.935)C9.357)))",
173 "((((xAy)B7.935)C9.357))",
174 "(((xA(yB7.935))C9.357))",
175 "((3.579A5.793)B(7.935C9.357))",
176 "((3.579A(5.793B(7.935C9.357))))",
177 "((3.579A((5.793B7.935)C9.357)))",
178 "((((3.579A5.793)B7.935)C9.357))",
179 "(((3.579A(5.793B7.935))C9.357))"
182 for (std::size_t i = 0; i <
sizeof(expr) /
sizeof(std::string); ++i)
191 for (std::size_t j = 0; j < operator_list.size(); ++j)
193 std::string curr_expr = expr[i];
194 for (std::size_t k = 0; k <
sizeof(loc)/
sizeof(std::size_t); ++k)
196 curr_expr[loc[k]] = operator_list[j][k];
200 e_4.push_back(curr_expr);
206 const std::string operators =
"+-*/";
207 std::size_t opr_index = 0;
208 for (std::size_t i = 0; i < e_3.size(); ++i)
210 std::string curr_str =
"(" + e_3[i] + operators[opr_index] + e_3[(i + 10) % e_3.size()] +
")";
211 e_3_comb.push_back(curr_str);
212 opr_index = (opr_index + 1) % operators.size();
217 const std::string operators =
"+-*/";
218 std::size_t opr_index = 0;
219 for (std::size_t i = 0; i < e_4.size(); ++i)
221 std::string curr_str =
"(" + e_4[i] + operators[opr_index] + e_4[(i + 10) % e_4.size()] +
")";
222 e_4_comb.push_back(curr_str);
223 opr_index = (opr_index + 1) % operators.size();
228 const std::string operators =
"+-*/";
229 std::size_t opr_index = 0;
230 for (std::size_t i = 0; i < e_4.size(); ++i)
232 std::string curr_str =
"(" + e_4[i] + operators[opr_index] + e_3[i % e_3.size()] +
")";
233 e_43_comb.push_back(curr_str);
234 opr_index = (opr_index + 1) % operators.size();
239 const std::string operators =
"+-*/";
240 std::size_t opr_index = 0;
241 for (std::size_t i = 0; i < e_4.size(); ++i)
243 std::string curr_str =
"(" + e_3[i % e_3.size()] + operators[opr_index] + e_4[i] +
")";
244 e_34_comb.push_back(curr_str);
245 opr_index = (opr_index + 1) % operators.size();
250 const std::string operators =
"+-*/";
251 std::size_t opr_index = 0;
252 for (std::size_t i = 0; i < e_4.size(); ++i)
254 std::size_t opr_index0 = opr_index;
255 std::size_t opr_index1 = opr_index = (opr_index + 1) % operators.size();
256 opr_index = (opr_index + 1) % operators.size();
257 std::string curr_str =
"(" + e_4[i] + operators[opr_index0] + e_3[i % e_3.size()] + operators[opr_index1] + e_4[(i + 3) % e_4.size()] +
")";
258 e_434_comb.push_back(curr_str);
263 const std::string operators =
"+-*/";
264 std::size_t opr_index = 0;
265 for (std::size_t i = 0; i < e_4.size(); ++i)
267 std::size_t opr_index0 = opr_index;
268 std::size_t opr_index1 = opr_index = (opr_index + 1) % operators.size();
269 opr_index = (opr_index + 1) % operators.size();
270 std::string curr_str =
"(" + e_3[i % e_3.size()] + operators[opr_index0] + e_4[i] + operators[opr_index1] + e_3[(i + 3) % e_3.size()] +
")";
271 e_343_comb.push_back(curr_str);
275 std::copy(e_3.begin(),e_3.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
276 std::copy(e_4.begin(),e_4.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
278 std::copy(e_3_comb.begin(),e_3_comb.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
279 std::copy(e_4_comb.begin(),e_4_comb.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
281 std::copy(e_43_comb.begin(),e_43_comb.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
282 std::copy(e_34_comb.begin(),e_34_comb.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
285 std::copy(e_434_comb.begin(),e_434_comb.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));
286 std::copy(e_343_comb.begin(),e_343_comb.end(),std::ostream_iterator<std::string>(std::cout,
"\n"));