Click to See Complete Forum and Search --> : Biggest c++ program


TeRG
08-31-2001, 08:56 PM
Post the biggest working c++ program you ever wrote (note that if its too big post a link to the website that it is on)
ill start:


//this demonstrates i/o
//it is very simple and short
//this document was written by Nick Steele
//in dec. 2000
//any questions about this program can be
//sent to nicksteele30@hotmail.com
#include <iostream.h>
int main()
{
int eatpizza;
cout << "Do you like pizza? ";
cin >> eatpizza;
if (eatpizza = 1)
cout <<"\nI agree"
if (eatpizza = 2)
cout <<"\nToo bad"
else
cout <<"\nYes or no!"
return 0
}

MrNewbie
08-31-2001, 09:01 PM
Are you sure you don't mean:
if (eatpizza == 1)
and:
if (eatpizza == 2)

?

Btw, and I mean no offence by this, but you've been doing C++ since at least december 2000 and that's the biggest program you've written?

TeRG
08-31-2001, 09:06 PM
Originally posted by MrNewbie:
<STRONG>Are you sure you don't mean:
if (eatpizza == 1)
and:
if (eatpizza == 2)

?

Btw, and I mean no offence by this, but you've been doing C++ since at least december 2000 and that's the biggest program you've written?</STRONG>

yah i mean == but it worked. I havn't had a chance to write a program since then. I have done bigger qbasic programs but i havn't don QB since i thought windows was a good OS.
I amused many people with this program but only people that know they can't do anything more then a hello world program.

sans-hubris
09-01-2001, 01:54 AM
I've done a project that was similar to a database program.

Super Bakemono
09-01-2001, 02:07 AM
http://sf.net/projects/proteusrpg/

2004 lines

MrNewbie
09-01-2001, 05:11 PM
Originally posted by Muad Dib --formerly ndogg:
<STRONG>I've done a project that was similar to a database program.</STRONG>

Me too, tho not in C++, in C, and it used nasty dos registers so no portability, tho that was just the interface.


yah i mean == but it worked. I havn't had a chance to write a program since then. I have done bigger qbasic programs but i havn't don QB since i thought windows was a good OS.
I amused many people with this program but only people that know they can't do anything more then a hello world program.

I know what you mean, I learn a language and can never find a decent project to do in it so I learn another to see if I can find anythingto do in that. My "best" language is probably perl. I can always find a cgi script to write for someone.

sans-hubris
09-01-2001, 05:50 PM
Originally posted by MrNewbie:
<STRONG>Me too, tho not in C++, in C, and it used nasty dos registers so no portability, tho that was just the interface.
</STRONG>
I was pretty proud of my effort, not because it was complex (though, in a way it was), but because it was a collaborative effort and I felt I did a really good job of managing everybody involved. The end code and algorithms were all my ideas, and while most of the code was mine, I didn't do all of it, but all of it came out to be exactly the way I wanted it. That's pretty hard to do with a group of people working on the same project.

farrow
09-01-2001, 10:05 PM
I wrote a compiler for an annoyingly laid out 8-instruction ISA for a class project...and for some eenie-meany-miney-moe related reason I decided to implement it in C++ instead of C(I think I had some kind of great plans of keeping it object oriented and modular...until the deadline started looming and I started hacking together stuff and breaking encapsulation a few times and realized that I would never even look at this code ever again, let alone modify it--code reuse---bah)...which was particularly annoying because I had to write a basic parser, the preprocessor, codegen/scheduler and the assembler. It went 3543 lines deep...and it was very fragile...but dat ain't what concerned me. What concerned me is I wrote the vast majority of it in like 72-hours. :eek: I kid you not...procrastination, sucks. :D

Anyway, speaking of codesize, I don't know if you guys and gals have seen this, but I found this page (http://dwheeler.com/sloc/redhat71-v1/redhat71sloc.html) interesting.

[ 01 September 2001: Message edited by: farrow ]

Strike
09-01-2001, 10:13 PM
I think my stuff was about 3000-4000 lines of stuff for my NASA stint two summers ago, but I can't post it or a link to it here :)

Remember, LOC (lines of code) is a poor metric for software :)

TeRG
09-01-2001, 10:16 PM
Originally posted by farrow:
<STRONG>I wrote a compiler for an annoyingly laid out 8-instruction ISA for a class project...and for some eenie-meany-miney-moe related reason I decided to implement it in C++ instead of C(I think I had some kind of great plans of keeping it object oriented and modular...until the deadline started looming and I started hacking together stuff and breaking encapsulation a few times and realized that I would never even look at this code ever again, let alone modify it--code reuse---bah)...which was particularly annoying because I had to write a basic parser, the preprocessor, codegen/scheduler and the assembler. It went 3543 lines deep...and it was very fragile...but dat ain't what concerned me. What concerned me is I wrote the vast majority of it in like 72-hours. :eek: I kid you not...procrastination, sucks. :D
[ 01 September 2001: Message edited by: farrow ]</STRONG>

Is there any way you could get me a copy of the source for that? sounds interesting.

[ 01 September 2001: Message edited by: TeRG ]

sans-hubris
09-02-2001, 10:22 AM
Originally posted by TeRG:
<STRONG>Is there any way you could get me a copy of the source for that? sounds interesting.

[ 01 September 2001: Message edited by: TeRG ]</STRONG>
If he says it sucks, it sucks.

optech
09-02-2001, 11:16 AM
it's perl, so does it still count?
185 lines...
i did a VB project in grade 11 computers that was 3500 lines... man, that was a pickle to debug! (getting around this whole swearing deal is kinda fun...)


Shell Sort (http://www.geocities.com/damage_inc17/shell2.pl)

TeRG
09-02-2001, 01:45 PM
Originally posted by optech:
<STRONG>it's perl, so does it still count?
185 lines...
i did a VB project in grade 11 computers that was 3500 lines... man, that was a pickle to debug! (getting around this whole swearing deal is kinda fun...)


Shell Sort (http://www.geocities.com/damage_inc17/shell2.pl)</STRONG>

I guess any language will work

Piix4
09-02-2001, 08:40 PM
port scanners if you are interested http://members.tripod.co.uk/mekanoid/skimmers.tar.bz2

jemfinch
09-02-2001, 09:23 PM
Originally posted by TeRG:
I guess any language will work

In that case, I've written an IRC bot in Python that's 1921 lines of code, and an IRC bot of similar (though still, at this point, lesser) capabilities in O'Caml that is 3501 lines of code, 1162 of which are standard Python modules I translated into O'Caml.

Jeremy

bwkaz
09-03-2001, 02:54 PM
1556 lines of code over 4 modules and 8 files.

It was a Wolfenstein-type (yes, DOS- or Win9x-only, sorry no Linux) FPS (with no guns -- I didn't get that far) based in Vietnam.

The executable was ~60K, and it allocated so much memory on the fly that it wouldn't run under Borland Turbo C++ 2's integrated debugger :eek:

I think it took up something on the order of 350-450K of DOS memory (there was only 640K MAX to be had...) that game was bloatware, worse than Windows if it was possible.

Don't ask for the source or anything, though, because I don't remember which BMP files or other utilities or anything go with it, and which files don't. So there's no guarantee AT ALL that anything at ALL would work or even be close to working. That code was the canonical worst way to make a working program.

It's almost painful to think of it again, but it was long.

(/me shudders involuntarily)

TeRG
09-03-2001, 09:01 PM
darn.....that would ov been a cool one to see the source of
/me goes to download the wolfenstein source to make up for that

bwkaz
09-04-2001, 08:23 AM
OK, there's a tarball on MTU's web server that should have everything (but no guarantees :p ).

It can be downloaded here (http://www.csl.mtu.edu/~bwkadzba/vietnam.tar.gz).

While trying to find which files were necessary, I had to look through the code again. UGH!!! It was UGLY!!!!

Oh well, it sort of worked.

The game does run under WINE, too! Well... for the most part. I still get a few random fatal errors in xray or yray... but I'm not too worried, because I got those in DOS too.

bob26
09-04-2001, 04:36 PM
This program lets you limit you amount on the computer (written in C). Yes, I know I am the only one that will find it useful. I bit over 200 lines, 2 files. It uses ncurses.

First file: comptime.h:


#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;

int uncol(const char *s);
int *unnum(int num, int *h, int *m);

int uncol(const char s[])
{
int i;
int j;
int ho;
int mi;
int num;
char c;
static char h[20];
static char m[20];

for (i = 0, c = s[i]; c != '\0'; i++, c = s[i]) /*set h*/
{
if (c == ':')
{
memcpy(h, s, (i) );
//printf("H: %s\n", h); /*debugging*/
//printf("S: %s\n", s); /*more debugging*/
}
//printf("i = %d\n", i);

}


memset(m, '\0', 19);

j = 0;
i -= 2;

for ( c = s[i]; c != '\0'; i++, c = s[i], j++) /*set m*/
{
m[j] = c;
//printf("Char: %c\n", c); /*even more fun debugging*/
}
//printf("M: %s\n", m); /*debugging*/
/*H and M are set! int converting time :-) */

ho = atoi(h);
mi = atoi(m);

/* final conversion process*/
ho *= 60;
num = (ho + mi);




return num;
}

int *unnum(int num, int *h, int *m)
{
*h = (num / 60);
*m = (num % 60);
return 0;
}




Second file: comptime.c


#include &lt;stdio.h&gt;
#include &lt;ncurses.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include "comptime.h"

#define OUTPUT 6
#define INPUT 7

#define ADD 1
#define SUBTRACT 2
#define DISPLAY 3
#define SE 4

int lowl;

int draw(int hl);
void openf();
void save();
void add();
void subtract();
void display();

int main()
{
int selected = 1;
int c;
openf();
initscr();
start_color();
keypad(stdscr, TRUE);
cbreak();
noecho();
draw(1);
while(1)
{
c = getch();
clear();

if (c == KEY_UP)
selected--;
if (c == KEY_DOWN)
selected++;
if (c == 10)
switch (selected)
{
case 1:
add();
break;
case 2:
subtract();
break;
case 3:
display();
break;
case 4:
save();
endwin();
return 0;
break;
}


if (selected == 0)
selected = 4;
if (selected == 5)
selected = 1;

draw(selected);

}

endwin();
return 0;
}


int draw(int hl)
{
init_pair(1, COLOR_BLACK, COLOR_WHITE);

if (hl == 1)
attron(COLOR_PAIR(1));
move(ADD, 0);
printw("Add");
if (hl == 1)
attroff(COLOR_PAIR(1));

init_pair(2, COLOR_BLACK, COLOR_WHITE);

if (hl == 2)
attron(COLOR_PAIR(1));
move(SUBTRACT, 0);
printw("Subtract");
if (hl == 2)
attroff(COLOR_PAIR(1));



init_pair(3, COLOR_BLACK, COLOR_WHITE);

if (hl == 3)
attron(COLOR_PAIR(1));
move(DISPLAY, 0);
printw("Display");
if (hl == 3)
attroff(COLOR_PAIR(1));

init_pair(4, COLOR_BLACK, COLOR_WHITE);

if (hl == 4)
attron(COLOR_PAIR(1));
move(SE, 0);
printw("Save and exit.");
if (hl == 4)
attroff(COLOR_PAIR(1));

return 0;
}

void openf()
{
char c;
int i = 0;
char highl[20];
FILE *ctime;
ctime = fopen("comptv", "r");
memset(highl, '\0', 20);

for (c = fgetc(ctime);c != EOF; c = fgetc(ctime), i++)
{
highl[i] = c;
}

lowl = uncol(highl);
}

void save()
{
int h;
int m;
FILE *ctime;
ctime = fopen("comptv", "w");
unnum(lowl, &h, &m);
fprintf(ctime, "%d:%d", h, m);
fclose(ctime);
}

void add()
{
char in[20];
int toadd;
echo();
nocbreak();
move(OUTPUT,0);
printw("How much would you like to add?");
move(INPUT,0);
getnstr(in, 20);
toadd = uncol(in);
lowl += toadd;
noecho();
cbreak();
}


void subtract()
{
char in[20];
int tosub;
echo();
nocbreak();
move(OUTPUT,0);
printw("How much would you like to subtract?");
move(INPUT,0);
getnstr(in, 20);
tosub = uncol(in);
lowl -= tosub;
noecho();
cbreak();
}

void display()
{
int h;
int m;
unnum(lowl, &h, &m);
move(OUTPUT,0);
if (m &lt; 10)
{
printw("Current computer time: %d:0%d", h, m);
}
else
{
printw("Current computer time: %d:%d", h, m);
}
}



[ 04 September 2001: Message edited by: bob26 ]

Dru Lee Parsec
09-04-2001, 07:56 PM
It's not in C++ (it's in Java) but the project I'm working on now has over 1500 files. Not Lines, FILES! Over 780 of them are Java files (the rest are html and property files). I'd say the average file size is around 600 lines. There are some with over 1500 lines and other that are just about 10 or 15. But most are in the 600 line range.

There are 4 coders working on this project so that would be (600 * 780) / 4 = about 117,000 lines per coder.

In reality I've probably only written about 8 or 10 thousand of those lines myself.

Do I win? :)

Concrete Geist
09-04-2001, 09:14 PM
I'm helping with a D&D character generator. My part is half done and is 1800 lines long so far. No clue as to how big the rest is tho.

f'lar
09-04-2001, 10:57 PM
Well, it's nothing like Dru Lee's, but mine would either be a tic tac toe game or an implementation of huffman's algorithm. I think the tic tac toe program was longer: 19 pages when we printed it out to turn in, 9 of them for the ai, which was my responsibility on the team. Since then I've learned a few things, and there are ways to do it much more quickly, but that's okay.

Giscardo
09-06-2001, 06:32 AM
Biggest C++ program would be the average size for that first "Hello World!" program
but Java? I think my project for data structures, a program that solves sliding block puzzles. I think it was around 2000-3000 lines, and it was faaast (for a java program that is). i could solve "the Donkey" in 18 seconds on the lab computer. And my final speed-optimized-data-abtraction-violating version it took 6 seconds.

MandK_10
09-06-2001, 06:41 PM
At work I have developed several programs for functional testing of circuit boards. Our programs are written in C and although we have several generic functions that make code writing easier, I have worked on at least 6 programs that have between 1600 and 2800 lines of code. Fortunately, most of it is cut and paste and modification for the particular products.

I have writen from scratch a database front end in Visual Basic. It is a ham radio logging program and it uses hundreds of lines of SQL to access an MS Access database. The exe is about 400KB(without runtimes), it has 14 forms, thousands of lines of code, and it took most of a year to write. I was teaching myself VB as I wrote the program.

pinoy
09-07-2001, 06:13 AM
Current project I'm involved in is probably around 300,000 lines of C++ code. I wrote about a third of it.