NeoPZ
generate.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include <string>
4 
5 using namespace std;
6 
7 string int2str(int i);
8 
9 int main()
10 {
11  const int n = 21;
12  int j;
13  string basename("tinyfad"), name;
14 
15  for (int i=1; i<n; ++i){
16  name = basename + int2str(i) + ".h";
17  ofstream fic(name.c_str());
18  fic << "#ifndef _tinyfad" << int2str(i) << "_h_\n#define _tinyfad" << int2str(i) << "_h_\n\n"
19  << "//*********************************************************\n"
20  << "// This file is generated by generate.cc.\n"
21  << "// Use this file for any modification\n"
22  << "//*********************************************************\n\n"
23  << "template <class T> class TinyFad<"<< i << ",T> {\n"
24  << "public:\n"
25  << " typedef T value_type;\n"
26  << " typedef T grad_type;\n"
27  << "protected:\n\n"
28  << " int n;\n"
29  << " T val_;\n\n";
30  for (j=0; j<i; ++j){
31  fic << " T dx" << j << "_;\n";
32  }
33  fic << "\n\npublic:\n"
34  << " void diff(const size_t ith, const size_t sz){\n"
35  << " n = ith+1;\n";
36  for (j=0; j<i; ++j){
37  fic << " dx" << j << "_ = T(0.);\n";
38  }
39  fic << "\n"
40  << " switch(ith){\n";
41  for (j=0; j<i; ++j){
42  fic << " case " << j << " : dx" << j << "_ = T(1.);break;\n";
43  }
44  fic << " default : cout << \"ith = \" << ith << \" out of definition set\" << endl;exit(1);\n"
45  << " }\n"
46  << " }\n\n"
47  << " TinyFad(const T& ind, const int ini) : n(ini+1), val_(ind) {\n";
48  for (j=0; j<i; ++j){
49  fic << " dx" << j << "_ = T(0.);\n";
50  }
51  fic << "\n"
52  << " switch(ini){\n";
53  for (j=0; j<i; ++j){
54  fic << " case " << j << " : dx" << j << "_ = T(1.);break;\n";
55  }
56  fic << " default : cout << \"ini = \" << ini << \" out of definition set\" << endl;exit(1);\n"
57  << " }\n";
58  fic << " }\n"
59  << " TinyFad() : n(0), val_(0.) {\n";
60  for (j=0; j<i; ++j){
61  fic << " dx" << j << "_ = T(0.);\n";
62  }
63  fic << " }\n"
64  << " TinyFad(const No_Initialization &): n(0) {}\n"
65  << " TinyFad(const T& in) : n(0), val_(in) {\n";
66  for (j=0; j<i; ++j){
67  fic << " dx" << j << "_ = T(0.);\n";
68  }
69  fic << " }\n"
70  << " TinyFad(const TinyFad<" << i << ",T> & in) : n(0), val_(in.val_) {\n";
71  for (j=0; j<i; ++j){
72  fic << " dx" << j << "_ = in.dx" << j << "_;\n";
73  }
74  fic << " }\n\n"
75  << " ~TinyFad() {}\n\n"
76  << " int N() const {return n-1;}\n\n"
77  << " const T& val() const { return val_;}\n"
78  << " T& val() { return val_;}\n\n";
79  for (j=0; j<i; ++j){
80  fic << " const T& d" << j << "() const { return dx" << j << "_;}\n"
81  << " T& d" << j << "() { return dx" << j << "_;}\n\n";
82  }
83  fic << " T& dx(int i){\n"
84  << " switch(i){\n";
85  for (j=0; j<i; ++j){
86  fic << " case " << j << " : return dx" << j << "_;\n";
87  }
88  fic << " default : cout << \"i out of bounds\" << endl;exit(1);\n"
89  << " }\n"
90  << " }\n"
91  << " const T& dx(int i) const {\n"
92  << " switch(i){\n";
93  for (j=0; j<i; ++j){
94  fic << " case " << j << " : return dx" << j << "_;\n";
95  }
96  fic << " default : cout << \"i out of bounds\" << endl;exit(1);\n"
97  << " }\n"
98  << " }\n"
99  << " T& d(int i){\n"
100  << " switch(i){\n";
101  for (j=0; j<i; ++j){
102  fic << " case " << j << " : return dx" << j << "_;\n";
103  }
104  fic << " default : cout << \"i out of bounds\" << endl;exit(1);\n"
105  << " }\n"
106  << " }\n"
107  << " const T& d(int i) const {\n"
108  << " switch(i){\n";
109  for (j=0; j<i; ++j){
110  fic << " case " << j << " : return dx" << j << "_;\n";
111  }
112  fic << " default : cout << \"i out of bounds\" << endl;exit(1);\n"
113  << " }\n"
114  << " }\n\n"
115  << " TinyFad<" << i << ",T> & operator = (const TinyFad<" << i << ",T> & in){\n"
116  << " val_ = in.val_;\n\n";
117  for (j=0; j<i; ++j){
118  fic << " dx" << j << "_ = in.dx" << j << "_;\n";
119  }
120  fic << "\n return *this;\n"
121  << " }\n\n"
122  << " TinyFad<" << i << ",T> & operator = (const T & in){\n"
123  << " val_ = in;\n\n";
124  for (j=0; j<i; ++j){
125  fic << " dx" << j << "_ = T(0.);\n";
126  }
127  fic << "\n return *this;\n"
128  << " }\n\n"
129  << " TinyFad<" << i << ",T> & operator += (const TinyFad<" << i << ",T> & in){\n";
130  for (j=0; j<i; ++j){
131  fic << " dx" << j << "_ += in.dx" << j << "_;\n";
132  }
133  fic << " val_ += in.val_;\n\n"
134  << "\n return *this;\n"
135  << " }\n"
136  << " TinyFad<" << i << ",T> & operator -= (const TinyFad<" << i << ",T> & in){\n";
137  for (j=0; j<i; ++j){
138  fic << " dx" << j << "_ -= in.dx" << j << "_;\n";
139  }
140  fic << " val_ -= in.val_;\n\n"
141  << " return *this;\n"
142  << " }\n"
143  << " TinyFad<" << i << ",T> & operator *= (const TinyFad<" << i << ",T> & in){\n";
144  for (j=0; j<i; ++j){
145  fic << " dx" << j << "_ = dx" << j << "_ * in.val_ + val_ * in.dx" << j << "_;\n";
146  }
147  fic << " val_ *= in.val_;\n\n"
148  << " return *this;\n"
149  << " }\n"
150  << " TinyFad<" << i << ",T> & operator /= (const TinyFad<" << i << ",T> & in){\n"
151  << " if (in.val_ == 0.) error(\"TinyFad & TinyFad::operator /= (const TinyFad & in), dividing by 0\");\n";
152  for (j=0; j<i; ++j){
153  fic << " dx" << j << "_ = ( dx" << j << "_ * in.val_ - val_ * in.dx" << j << "_ ) / in.val_ / in.val_ ;\n";
154  }
155  fic << " val_ /= in.val_;\n\n"
156  << " return *this;\n"
157  << " }\n\n"
158  << " TinyFad<" << i << ",T> & operator += (const T & in){"
159  << " val_ += in;\n\n"
160  << " return *this;\n"
161  << " }\n"
162  << " TinyFad<" << i << ",T> & operator -= (const T & in){"
163  << " val_ -= in;\n\n"
164  << " return *this;\n"
165  << " }\n"
166  << " TinyFad<" << i << ",T> & operator *= (const T & in){\n"
167  << " val_ *= in;\n\n";
168  for (j=0; j<i; ++j){
169  fic << " dx" << j << "_ *= in;\n";
170  }
171  fic << "\n return *this;\n"
172  << " }\n"
173  << " TinyFad<" << i << ",T> & operator /= (const T & in){\n"
174  << " if ( in == T(0.) ) error(\"TinyFad & TinyFad::operator /= (const T & in), dividing by 0\");\n"
175  << " val_ /= in;\n\n";
176  for (j=0; j<i; ++j){
177  fic << " dx" << j << "_ /= in;\n";
178  }
179  fic << "\n return *this;\n"
180  << " }\n\n"
181  << " TinyFad<" << i << ",T> operator++(int){\n"
182  << " TinyFad<" << i << ",T> tmp(*this);\n"
183  << " tmp.val_++;\n"
184  << " return tmp;\n"
185  << " };\n"
186  << " TinyFad<" << i << ",T> operator--(int){\n"
187  << " TinyFad<" << i << ",T> tmp(*this);\n"
188  << " tmp.val_--;\n"
189  << " return tmp;\n"
190  << " };\n"
191  << " TinyFad<" << i << ",T> & operator++(){"
192  << " ++val_;\n"
193  << " return *this;\n"
194  << " }\n"
195  << " TinyFad<" << i << ",T> & operator--(){"
196  << " --val_;\n"
197  << " return *this;\n"
198  << " }\n"
199  << "};\n\n\n"
200  << "template <class T> inline TinyFad<" << i << ",T> operator + (const TinyFad<" << i << ",T>& in)\n"
201  << "{\n"
202  << " return TinyFad<" << i << ",T>(in);\n"
203  << "}\n\n"
204  << "template <class T> inline TinyFad<" << i << ",T> operator - (const TinyFad<" << i << ",T>& in)\n"
205  << "{\n"
206  << " TinyFad<" << i << ",T> tmp;\n"
207  << " tmp -= in;\n"
208  << " return tmp; \n"
209  << "}\n\n"
210  << "template <class L, class R> inline\n"
211  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote >\n"
212  << "operator +(const TinyFad<" << i << ",L>& un, const TinyFad<" << i << ",R>& deux) {\n\n"
213  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
214  << " No_Initialization nothing;\n"
215  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
216  for (j=0; j<i; ++j){
217  fic << " tmp.d" << j << "() = un.d" << j << "() + deux.d" << j << "();\n\n";
218  }
219  fic << " tmp.val() = un.val() + deux.val();\n\n"
220  << " return tmp;\n"
221  << "}\n\n"
222  << "template <class L, class R> inline\n"
223  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote>\n"
224  << "operator +(const TinyFad<" << i << ",L>& un, const R& deux) {\n\n"
225  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
226  << " No_Initialization nothing;\n"
227  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
228  for (j=0; j<i; ++j){
229  fic << " tmp.d" << j << "() = un.d" << j << "();\n\n";
230  }
231  fic << " tmp.val() = un.val() + deux;\n\n"
232  << " return tmp;\n"
233  << "}\n\n"
234  << "template <class L, class R> inline\n"
235  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote >\n"
236  << "operator +(const L& un, const TinyFad<" << i << ",R>& deux) {\n"
237  << " return operator +(deux,un);\n"
238  << "}\n\n"
239  << "template <class L, class R> inline\n"
240  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote >\n"
241  << "operator *(const TinyFad<" << i << ",L>& un, const TinyFad<" << i << ",R>& deux) {\n\n"
242  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
243  << " No_Initialization nothing;\n"
244  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
245  for (j=0; j<i; ++j){
246  fic << " tmp.d" << j << "() = un.d" << j << "()*deux.val() + un.val() * deux.d" << j << "();\n\n";
247  }
248  fic << " tmp.val() = un.val() * deux.val();\n\n"
249  << " return tmp;\n"
250  << "}\n\n"
251  << "template <class L, class R> inline\n"
252  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote >\n"
253  << "operator *(const TinyFad<" << i << ",L>& un, const R& deux) {\n\n"
254  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
255  << " No_Initialization nothing;\n"
256  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
257  for (j=0; j<i; ++j){
258  fic << " tmp.d" << j << "() = un.d" << j << "()*deux;\n\n";
259  }
260  fic << " tmp.val() = un.val() * deux;\n\n"
261  << " return tmp;\n"
262  << "}\n\n"
263  << "template <class L, class R> inline\n"
264  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote >\n"
265  << "operator *(const L& un, const TinyFad<" << i << ",R>& deux) {\n\n"
266  << " return operator *(deux,un);\n"
267  << "}\n\n\n"
268  << "template <class L, class R> inline\n"
269  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote >\n"
270  << "operator -(const TinyFad<" << i << ",L> & un, const TinyFad<" << i << ",R> & deux) {\n\n"
271  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
272  << " No_Initialization nothing;\n"
273  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
274  for (j=0; j<i; ++j){
275  fic << " tmp.d" << j << "() = un.d" << j << "() - deux.d" << j << "();\n\n";
276  }
277  fic << " tmp.val() = un.val() - deux.val();\n\n"
278  << " return tmp;\n"
279  << "}\n\n"
280  << "template <class L, class R> inline\n"
281  << "TinyFad<" << i << ",typename NumericalTraits<L,R>::promote>\n"
282  << "operator -(const L & un, const TinyFad<" << i << ",R> & deux) {\n\n"
283  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
284  << " No_Initialization nothing;\n"
285  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
286  for (j=0; j<i; ++j){
287  fic << " tmp.d" << j << "() -= deux.d" << j << "();\n\n";
288  }
289  fic << " tmp.val() = un - deux.val();\n\n"
290  << " return tmp;\n"
291  << "}\n\n"
292  << "template <class L, class R> inline\n"
293  << "TinyFad<" << i << ", typename NumericalTraits<L,R>::promote > \n"
294  << "operator -(const TinyFad<" << i << ",L> & un, const R & deux) {\n"
295  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
296  << " No_Initialization nothing;\n"
297  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
298  for (j=0; j<i; ++j){
299  fic << " tmp.d" << j << "() = un.d" << j << "();\n\n";
300  }
301  fic << " tmp.val() = un.val() - deux;\n\n"
302  << " return tmp;\n"
303  << "}\n\n"
304  << "template <class L, class R> inline\n"
305  << "TinyFad<" << i << ", typename NumericalTraits<L,R>::promote > \n"
306  << "operator /(const TinyFad<" << i << ",L> & un, const TinyFad<" << i << ",R> & deux) {\n\n"
307  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
308  << " if (deux.val() == 0.) error(\"TinyFad & TinyFad::operator /(const TinyFad<" << i << ",L> & un, const TinyFad<" << i << ",R> & deux), dividing by 0\");\n\n"
309  << " No_Initialization nothing;\n"
310  << " TinyFad<" << i << ",value_type> tmp( nothing );\n"
311  << " value_type dval = deux.val();\n\n";
312  for (j=0; j<i; ++j){
313  fic << " tmp.d" << j << "() = ( un.d" << j << "()* deux.val() - un.val() * deux.d" << j << "() ) / dval / dval ;\n\n";
314  }
315  fic << " tmp.val() = un.val() / dval;\n\n"
316  << " return tmp;\n"
317  << "}\n\n"
318  << "template <class L, class R> inline\n"
319  << "TinyFad<" << i << ", typename NumericalTraits<L,R>::promote > \n"
320  << "operator /(const L & un, const TinyFad<" << i << ",R> & deux) {\n\n"
321  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
322  << " if (deux.val() == 0.) error(\"TinyFad & TinyFad::operator /(const L & un, const TinyFad<" << j << ",R> & deux), dividing by 0\");\n\n"
323  << " No_Initialization nothing;\n"
324  << " TinyFad<" << i << ",value_type> tmp( nothing );\n"
325  << " value_type dval = deux.val();\n\n";
326  for (j=0; j<i; ++j){
327  fic << " tmp.d" << j << "() = - un * deux.d" << j << "() / dval / dval ;\n\n";
328  }
329  fic << " tmp.val() = un / dval;\n\n"
330  << " return tmp;\n"
331  << "}\n\n"
332  << "template <class L, class R> inline\n"
333  << "TinyFad<" << i << ", typename NumericalTraits<L,R>::promote > \n"
334  << "operator /(const TinyFad<" << i << ",L> & un, const R & deux) {\n\n"
335  << " typedef typename NumericalTraits<L,R>::promote value_type;\n\n"
336  << " if (deux == 0.) error(\"TinyFad & TinyFad::operator /(const TinyFad<" << i << ",L> & un, const R & deux), dividing by 0\");\n\n"
337  << " No_Initialization nothing;\n"
338  << " TinyFad<" << i << ",value_type> tmp( nothing );\n\n";
339  for (j=0; j<i; ++j){
340  fic << " tmp.d" << j << "() = un.d" << j << "() / deux;\n\n";
341  }
342  fic << " tmp.val() = un.val() / deux;\n\n"
343  << " return tmp;\n"
344  << "}\n\n"
345 
346 
347 
348 
349 
350  << "template <class T> TinyFad<" << i << ",T> exp (const TinyFad<" << i << ",T>& in)\n"
351  << "{\n"
352  << " TinyFad<" << i << ",T> tmp(exp(in.val()));\n\n";
353  for (j=0; j<i; ++j){
354  fic << " tmp.d" << j << "() = in.d" << j << "()*exp(in.val());\n";
355  }
356  fic << "\n return tmp;\n"
357  << "}\n\n"
358  << "template <class T> TinyFad<" << i << ",T> log (const TinyFad<" << i << ",T>& in)\n"
359  << "{\n"
360  << " if ( in.val() <= 0) error(\"TinyFad log (const TinyFad& in) : zero or negative value\");\n"
361  << " TinyFad<" << i << ",T> tmp(log(in.val()));\n\n";
362  for (j=0; j<i; ++j){
363  fic << " tmp.d" << j << "() = in.d" << j << "() / in.val();\n";
364  }
365  fic << "\n return tmp;\n"
366  << "}\n\n"
367  << "template <class T> TinyFad<" << i << ",T> sqrt (const TinyFad<" << i << ",T>& in)\n"
368  << "{\n"
369  << " if ( in.val() < 0. ) error(\"TinyFad<" << i << ",T> sqrt (const TinyFad& in) : negative value\");\n"
370  << " TinyFad<" << i << ",T> tmp(sqrt(in.val()));\n\n"
371  << " bool test=true;\n"
372  << " if ( in.val() == T(0.) ){\n";
373  for (j=0; j<i; ++j){
374  fic << " if ( in.d" << j << "() != T(0.) ) test = false;\n\n";
375  }
376  fic << " if ( !test )\n"
377  << " error(\"TinyFad<" << i << ",T> sqrt (const TinyFad& in) : null value\");\n"
378  << " }\n"
379  << " else {\n";
380  for (j=0; j<i; ++j){
381  fic << " tmp.d" << j << "() = in.d" << j << "() / sqrt(in.val()) / 2.;\n";
382  }
383  fic << " }\n"
384  << "\n return tmp;\n"
385  << "}\n\n"
386  << "template <class T> TinyFad<" << i << ",T> sin (const TinyFad<" << i << ",T>& in)\n"
387  << "{\n"
388  << " TinyFad<" << i << ",T> tmp( sin(in.val()) );\n\n";
389  for (j=0; j<i; ++j){
390  fic << " tmp.d" << j << "() = in.d" << j << "() * cos( in.val() );\n";
391  }
392  fic << "\n return tmp;\n"
393  << "}\n\n"
394  << "template <class T> TinyFad<" << i << ",T> cos (const TinyFad<" << i << ",T>& in)\n"
395  << "{\n"
396  << " TinyFad<" << i << ",T> tmp(cos(in.val()));\n\n";
397  for (j=0; j<i; ++j){
398  fic << " tmp.d" << j << "() = - in.d" << j << "() * sin( in.val() );\n";
399  }
400  fic << "\n return tmp;\n"
401  << "}\n\n"
402  << "template <class T> TinyFad<" << i << ",T> tan (const TinyFad<" << i << ",T>& in)\n"
403  << "{\n"
404  << " if ( in.val() == 0) error(\"TinyFad tan (const TinyFad& in) undiefined in 0.\");\n"
405  << " TinyFad<" << i << ",T> tmp(tan(in.val()));\n\n"
406  << " T cosinus = cos(in.val());\n";
407  for (j=0; j<i; ++j){
408  fic << " tmp.d" << j << "() = in.d" << j << "() / cosinus / cosinus;\n";
409  }
410  fic << "\n return tmp;\n"
411  << "}\n\n"
412  << "template <class T> TinyFad<" << i << ",T> pow (const TinyFad<" << i << ",T>& in, double e)\n"
413  << "{\n"
414  << " TinyFad<" << i << ",T> tmp(pow(in.val(), e));\n\n";
415  for (j=0; j<i; ++j){
416  fic << " tmp.d" << j << "() = e*in.d" << j << "()*pow(in.val(), e-1);\n";
417  }
418  fic << "\n return tmp;\n"
419  << "}\n\n"
420  << "template <class T> TinyFad<" << i << ",T> pow (const TinyFad<" << i << ",T>& un, const TinyFad<" << i << ",T>& deux)\n"
421  << "{\n"
422  << " if (un.val() == 0) error(\"TinyFad pow (const TinyFad& un, const TinyFad& deux), un = 0. \");\n"
423  << " TinyFad<" << i << ",T> tmp(pow(un.val(), deux.val()));\n\n";
424  for (j=0; j<i; ++j){
425  fic << " tmp.d" << j << "() = deux.d" << j << "() * log(un.val()) * pow(un.val(), deux.val())\n"
426  << " + deux.val() * un.d" << j << "() * pow(un.val(), deux.val()-1);\n";
427  }
428  fic << "\n return tmp;\n"
429  << "}\n\n"
430  << "template <class T> TinyFad<" << i << ",T> pow (const TinyFad<" << i << ",T>& in, const int e)\n"
431  << "{\n"
432  << " TinyFad<" << i << ",T> tmp( pow((double)in.val(), (double)e) );\n\n";;
433  for (j=0; j<i; ++j){
434  fic << " tmp.d" << j << "() = e*in.d" << j << "()*pow((double)in.val(), (double)e-1);\n";
435  }
436  fic << "\n return tmp;\n"
437  << "}\n\n"
438  << "template <class T> TinyFad<" << i << ",T> abs (const TinyFad<" << i << ",T>& in)\n"
439  << "{\n"
440  << " int sign = in.val() > 0? 1:0;\n\n"
441  << " if (sign) return in;\n"
442  << " else return (-in);\n"
443  << "}\n\n"
444  << "template <class T> ostream& operator << (ostream& os, const TinyFad<" << i << ",T>& a)\n"
445  << "{\n"
446  << " os.setf(ios::fixed,ios::scientific);\n"
447  << " os.width(12);\n"
448  << " os << a.val() << \" [\";\n\n";
449  for (j=0; j<i; ++j){
450  fic << " os.width(12);\n"
451  << " os << a.d" << j << "();\n";
452  }
453  fic << "\n os << \"]\";\n"
454  << "\n return os;\n"
455  << "}\n"
456  << "\n\n#endif\n";
457  }
458 
459 
460  return 0;
461 }
462 
463 
464 string int2str(int i)
465 {
466  switch(i){
467  case 1 : return string("one");
468  case 2 : return string("two");
469  case 3 : return string("three");
470  case 4 : return string("four");
471  case 5 : return string("five");
472  case 6 : return string("six");
473  case 7 : return string("seven");
474  case 8 : return string("eight");
475  case 9 : return string("nine");
476  case 10 : return string("ten");
477  case 11 : return string("eleven");
478  case 12 : return string("twelve");
479  case 13 : return string("thirteen");
480  case 14 : return string("fourteen");
481  case 15 : return string("fifteen");
482  case 16 : return string("sixteen");
483  case 17 : return string("seventeen");
484  case 18 : return string("eighteen");
485  case 19 : return string("nineteen");
486  case 20 : return string("twenty");
487  default : cout << "i out of definition set" << endl;exit(1);
488  }
489 
490 }
int main()
Definition: generate.cc:9
string int2str(int i)
Definition: generate.cc:464