473,805 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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***********@s i.htnet.hr
Jul 22 '05 #1
4 2989
* 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;
}
}

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #2
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***********@s i.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 ,"Three")S(4,"F our")
S(5,"Five")S(6, "Six")S(7,"Seve n")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(1 8,"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,"T hirty")T(4,"For ty")T(5,"Fifty" )T(6,"Sixty")T( 7,
"Seventy")T(8," Eighty")T(9,"Ni nety")t<i I>struct pre<false,I>{
static v print(){print_t ens<(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<<"Ta ke 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>();bri dge<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
Jul 22 '05 #3

sk6307 <sk****@btinter net.com> wrote in message
news:cd******** **@titan.btinte rnet.com...
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***********@s i.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 ,"Three")S(4,"F our")
S(5,"Five")S(6, "Six")S(7,"Seve n")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(1 8,"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,"T hirty")T(4,"For ty")T(5,"Fifty" )T(6,"Sixty")T( 7,
"Seventy")T(8," Eighty")T(9,"Ni nety")t<i I>struct pre<false,I>{
static v print(){print_t ens<(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<<"Ta ke 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>();bri dge<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 !!!!!!!!!!!!!!! !!!!
Jul 22 '05 #4
"Robert Bralic" <ro***********@ si.htnet.hr> wrote in message news:<cd******* ***@ls219.htnet .hr>...
[happy song code example snipped]
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
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
3689
by: JS | last post by:
We have the same floating point intensive C++ program that runs on Windows on Intel chip and on Sun Solaris on SPARC chips. The program reads the exactly the same input files on the two platforms. However, they generate slightly different results for floating point numbers. Are they really supposed to generate exactly the same results? I guess so because both platforms are supposed to be IEEE floating point standard (754?) compliant. ...
27
3147
by: hokiegal99 | last post by:
Hi Guys, This is my first C program. I started programming in Python. Please look over this source and let me know if I'm doing anything wrong. I want to start out right with C, so if you see anything wrong tell me now while I am learning! Thanks !!! > #include <stdio.h>
3
1416
by: Crypto Loko | last post by:
Hello everyone, I was wondering if anyone should have any TC++ v3.0 / BC++ v3.1, or DJGPP v2.03 code for RSA implementation (or similar public-key scheme(s)) - of either a module, a library, or even a small program? I have tried an old version of RSAREF (I believe it was v1.0) with TC++ v3.0,
2
2061
by: BKMiller | last post by:
Hello everyone, I'm just getting started playing around with C++, so please don't laugh too loudly at my crude source code, okay? (o^^o) I'm combining together several introductory exercises into one small program. My compiler and IDE is Visual C++ Express Edition, and the book I'm using is Teach Yourself C++ in 24 hours by Jesse Liberty and David Horvath. While playing around with the code a little bit I found something I couldn't...
17
2545
by: Student | last post by:
Hi All, I have an assignment for my Programming language project to create a compiler that takes a C++ file as input and translate it into the C file. Here I have to take care of inheritance and operator overloading and virtual functions. I mean it should not hamper the C++ meaning. In frank and simple terms i need to implement a small C++ compiler in C++, and i want the intermediate representation to be C. Please help me in this....
27
2182
by: Neil | last post by:
Hello all! I wrote program with a array of pointers, and I suspect they are pointing at each other in the Do ...While loop. Something is messed up with the increment variable word. A program clip of what I'm talking about. #include <stdio.h> #include <string.h>
169
9228
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide untaking to create a toolchain for it. Way back when, there used to be something called "Small C". I wonder if the creator(s) of that would want to embark on creating a nice little Small C++ compiler devoid of C++ language features that make...
6
1799
by: Bill Cunningham | last post by:
As I have been studing my tutorial I came up with this question. I took char passw(char name); and initialied this function in a header with other includes for standard library headers. This doesn't seem to work so is what I want this? char passw(char *name); I haven't got to pointers in the tutorial and I'm taking my time. But in this particualr function should it be initialized with a pointer? Does
16
3369
by: scholz.lothar | last post by:
I want to add some extension features to my program and this would require that i bundle a small c compiler with my program. On Unix it seems that tiny-c can do this, but i don't know about windows.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.