Robert Bralic wrote:
Hi,
Can anybody send to me aby small c++ program that is
compilable vith gpp under Linux ,that I can belive that C++
realy exists ,(1000-2000) lines program source.
ro***********@si.htnet.hr
No problem, here you go:
#include <iostream>
using namespace std;
#define s string
#define i int
#define v void
#define c cout
#define in inline
#define t template
#define S(num, s) t<>struct pre<true, num>{static v print(){c<<s;}};
#define O(ones, s) t<>in v p<ones>(){c<<s;}
#define T(tens, s) t<>in v print_tens<tens>(){c<<s;}
t<bool small,i I>struct pre;t<i ones>in v p();t<i tens>in v
print_tens();S(0,"No")S(1,"One")S(2,"Two")S(3,"Thr ee")S(4,"Four")
S(5,"Five")S(6,"Six")S(7,"Seven")S(8,"Eight")S(9," Nine")S(10,"Ten")
S(11,"Eleven")S(12,"Twelve")S(13,"Thirteen")S(14," Fourteen")S(15,
"Fifteen")S(16,"Sixteen")S(17,"Seventeen")S(18,"Ei ghteen")S(19,
"Nineteen")O(0," ")O(1," one")O(2," two")O(3," three")O(4," four")
O(5," five")O(6," six")O(7," seven")O(8," eight")O(9," nine")T(2,
"Twenty")T(3,"Thirty")T(4,"Forty")T(5,"Fifty")T(6, "Sixty")T(7,
"Seventy")T(8,"Eighty")T(9,"Ninety")t<i I>struct pre<false,I>{
static v print(){print_tens<(I-I%10)/10>();p<(I%10)>();}};t<i I>
v pr(){pre<(I<20),I>::print();} t<i I>in v B(){pr<I>();c<<" bottles \
of beer";}t<>in v B<1>(){pr<1>();c<<" bottle of beer";}t<i I>in
v Bo(){B<I>();c << " on the wall";}t<i I>in v stanza(){Bo<I>();c<<
",\n";B<I>();c<<",\n";}t<i I>in v bridge(){c<<"Take one down, pass \
it around,"<<endl;Bo<I-1>();c<<",\n";}t<>in v bridge<0>(){c<<"Go to \
the store and buy some more,"<<endl;Bo<99>();}t<i I>in v verse(){
stanza<I>();bridge<I>();}t<i I>in v sing(){verse<I>();c<<endl;sing<I
-1>();}t<>in v sing<0>(){verse<0>();}i main(){sing<99>();}
I hope it helps :)
sk