Any small program in c++ compilable with gnu gpp compiler

R

Robert Bralic

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.


(e-mail address removed)
 
A

Alf P. Steinbach

* Robert Bralic:
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.

#include <iostream>
int main()
{
for( unsigned i = 0; i < 10000; ++i )
{
std::cout << "Do my assignment for me" << std::endl;
}
}
 
S

sk6307

Robert said:
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.


(e-mail address removed)

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,"Three")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,"Eighteen")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
 
R

Robert Bralic

sk6307 said:
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,"Three")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,"Eighteen")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

IS THIS(1000-2000) lines of code !!!!!!!!!!!!!!!!!!!
 
P

puppet_sock

Robert Bralic said:
IS THIS(1000-2000) lines of code !!!!!!!!!!!!!!!!!!!

99 request to do my homework on the group
99 request to do my homework.
Download one request
Deride it with glee.
98 requests to do my homework on the group.


Hey Bob. Read the FAQ.
Socks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top