Example of a long C++ program?

Hi, I've been learning the C++ syntax for about 3 months now (on my own) and I don't really see how I can make any sort of "long" program that is at least 500 lines long, I've only managed to get 170 with a tic-tac-toe console game. If you have any C++ program source codes lying around, I'd appreciate it if you could post it here. I won't use it for anything, I just want to see how the format works.


P.S. if anyone asks, I can provide the code for the tictactoe program.

Thanks!
Made a calculator program, learnt this from programming and principles using c++

Im posting code on another place as I cross the max limit if I post here
http://textuploader.com/523ur
Thanks but are you sure its in C++? When I copied it into my compile (code blocks) it had a lot of errors and didn't compile.
The code includes a file called "std_lib_facilities.h" which you also need.
You can probably make it compile by replacing the first line with the following:
1
2
3
4
5
6
7
8
9
// #include "std_lib_facilities.h"
#include <iostream>
#include <vector>
#include <string>
#include <exception>

using namespace std;

// ... 


Of course, normally I would advocate against using namespace, but I can't be bothered to go through the code and see what exactly is being used. I may have missed a header or two, too, but it should work.
Last edited on
Nope. I don't get why it shouldn't work... Thanks again,
I also couldn't compile in VS 2013. One problem is that it uses some of the newest features in C++11 and also because of the missing include file. Maybe he will post the include file.
Meh, I'm still hoping for some 1-2 thousand line C++ program
http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Compiled using g++
Apologies for not posting the header file.
I must say that Im a beginner and new.
After compiling, open program and type "help" for basic how to use
Its very simple program
I'm a beginner too, but how do you use that header? Do I just paste it in?

I'm a beginner too, but how do you use that header? Do I just paste it in?

No, but close. On your compiler there is an option for creating a .h file. Choose that and create one. Name it std_lib_facilities and be sure to save it in the same location as the cpp file. Then copy ephraimr's code into that header file, and it should work (given that you included it in your main cpp)
Best way is to create an empty file and paste it in. Save it as std_lib_facilities.h in the same folder as your main file.

Of course, normally I would advocate against using namespace, but I can't be bothered to go through the code and see what exactly is being used.


using namespace std; is part of that header file, iirc.
To use the header, just save it with the .h extension, instead of .txt, and put it in with the rest of your code files. Instead of "add new" in your IDE choose "add existing", or whatever the equivalent is.
Topic archived. No new replies allowed.