Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I thought one of the best ways to familiarise myself with C/C++, is to make a helpful library. I was maybe thinking like a geometry library, like to calculate areas, surface area, etc. It would be useful in game programming. Or maybe an algebra library, like for different formulas like the distance formula, quadratic formula, etc. Or maybe like a standard library for very simple functions, like calculating the number of items in an array.
If it is for the sake of an exercise, writing a library to deal with fractions is a good one.
http://en.wikipedia.org/wiki/Fraction_(mathematics)
Implement the basic operations and a way to print them.
Find a problem that you need to solve. Look around to see if a library exists already. If not, then solve it in a way that others can benefit and put the library up on something like github.
But please be prepared to support it if you want to really see it being used - nothing worse than a open source project that isn't well supported.
I'd encourage you to try and come up with an application that would make use of the library. A game, a business app, whatever. Maybe even come up with an application idea first then determine what libraries you would need that aren't readily available.
That way you know you'll be creating something of practical value and not just undertaking a purely intellectual exercise. Try and avoid just plucking a library idea out of the air as you'll inevitably reimplement something that already exists. That's fine for you to learn but it would be awesome if you could create something others could benefit from in the process :)
Also, your application will provide a ready made test for your library.
Much of what you're listing has been done and can be found in Boost and or GSL. If learning is your goal, how about write a Qt application that uses some of these math functions?
Creating 'toy' level libraries doesn't help much on learning C++. I'd suggest you look at the libstdc++ bugs, try to understand and help fixing some ones.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
So I want to start learning how to make real games and programs, and I bumped into C++ but then I realized that there is also Visual C++. If there's any difference - tell me what it is. If you have any suggestions on how to start in general with C++ program making (not that black window), please let me know.
I just want a cool program to run code on (still don't know any IDEs for C++), and want to start coding real hardcore programs.
Thank you for all the answers in advance!
if you want to start coding and learning C++ I would recommend you to watch a bunch of tutorials, maybe even read a book about it. But the best way to learn coding is, to code. Write as many little programs as you can. Get used to the programming language, try out new things. Write useless programs noone needs.
It sounds like you are very new to all of this and in my opinion it could be to complicated to learn writing "real hardcore programs" in a short time. If you are not willing to put some effort into this you'll probably never write any "real hardcore programs". It is'nt as easy as you may think. You will have to learn a lot of things and it will probably take a while. But once you learned the basics it'll be fun to write your own programs etc..
In addition to #vveil answer:
Learn to think or write out what your program should do before writing any code. Even for smaller programs. You can check against you set goals if your coding was successful. Maybe come up with a sketch for more complicated programs (when it comes to inheritance). And you train to think before writing anything.
If you are really into it there are plenty of playful tutorials (learn-cpp) out there where the code quest is provided and you try to solve it. Sometime you can code online and do not have to bother about toolchain and environment.
Most important: Have fun!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Hello I'm new to coding in C++, thankfully I'm quickly learning how to use it. So far I've heard of libraries and how they can be used in an application.
My questions is are:
What do I need to do after I download ANY library?
How do I #include "library.h" or #include <library> and use it
in a project without intellisense or the compiler going nuts?
What if the library is header only?
What should I look for?
Are there any apps I need?
What if there's no build folder?
Usually the instructions are unclear to me, maybe it's because I'm still green.
Please try to explain this in an easy to follow manner like if you were teaching it to someone that knows NOTHING: I've tried to follow other guides but with no luck.
Beforehand, thank you very much!
If it's header-only, including the header is enough. Otherwise, a library can be any piece of code in any form (source in various languages, binary, shared, static, ...). It's impossible to cover all the cases, each library is supposed to come with its own documentation.
Each and every library has a specific license (eg MIT, GPL, LGPL etc) for it's use. There can be differences between uses (eg personal, academic and commercial etc) but often not. It's quite easy to learn about the major licenses and how they might apply to your use case on the internet. But if you are doing this for commercial purposes or have any doubt whatsoever consult a lawyer.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to develop a time table generator software for my college. Obviously it requires a great deal of constraint satisfaction i.e. I need to satisfy a lot of rules in order to generate a bunch of time tables where classes do not clash. After doing some research and reading this article, I feel I need to use some AI in it. Now, I am a complete newbie to AI. Can anyone tell me which algorithm will work best in my case?
The simplest algorithm that you can use for this problem is genetic algorithm (or any other evolutionary algorithm). Solving this problem using GA is very simple but yet effective. There are lots of papers and codes that have used this approach for this problem.
If you have few rules and constraints, you may want to use exact straightforward techniques like backtracking with CSP heuristics to speed it up, but if there are lots of classes and constraints, I suggest Genetic Algorithm.
Well, not a trivial task indeed. Problems like this one are VERY hard to solve.
Here I can recommend you two things:
Use an existing CSP/COP solver and describe your constraints in its language. These solvers are very good, fast and tuned, being developed for years.
Educate yourself in the area of Discrete Optimization (there was a course at coursera.org with the same name which was great). Only after you grasp the basics of how these things work can you try to write your own solver. But let you be warned! Discrete optimization is pain and suffering :-).
This is by no means a suitable place to just tell you how CSP/COP works. It is a very broad and difficult field.
I wish you good luck!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have code to solve 2D truss structures implemented in C++ (as a console application).
I would like to add some simple graphics to it in order to visualize the initial structure and the deformed form. Example: http://people.rit.edu/pnveme/VenkatCOMSOL42/COMSOLTruss2D/ExtractingInfoinMATLAB_01.png
But I have no idea of how to add graphics in any way. How can I implement this kind of graphics?
Cross platform (preferred) or windows.
I doubt this is the answer you want, but to be honest, implementing plotting functionality isn't trivial, even if you're not doing it from scratch: you'll have to review a number of libraries, choose one, and get to grips with it.
Unless it's essential that the plotting functionality be integrated with the solver (e.g. for a product), I think you ought to consider simply exporting your results to, say, a simple ASCII matrix format that can be easily imported into a variety of environments with extensive and flexible plotting capabilities, one or more of which you probably already know (e.g. Matlab, R, Octave, etc.)
One option would be to generate a file which can be shown by another program. For example, generating SVG and using the browser to display it sounds like it would be good for your case, you can even easily include it in a report.
Check out SDL: http://www.libsdl.org/ It's cross-platform and has a ton of features. It maybe a bit overwhelming for your task, but I thought it was very easy to grasp when I was a newcomer.
There is a derivative of SDL that lets you draw basic shapes such as lines and points and is incredibly easy to use:
http://sdl-draw.sourceforge.net/
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I really want to learn more about C++. I know the basics, and I know the concepts, and I have even been able to create C++ projects myself, but my problem is being able to view, fix, and add to code I haven't written myself. I have looked at some open source projects on sourceforge, etc, but many of them are so big or there are soooo many projects available until I don't know what to do.
Are there any "small or simple" projects or tasks in C++ that will allow me to extend my knowledge of C++ by use of hands on experience?
If you are already able to create own projects, I think the best way to learn how to read&change someone's code is to get job in software company. They even will pay for it :)
Creating your own client / server application using socket programming is a big and fun area in programming which you should check out.
http://subjects.ee.unsw.edu.au/tele3118/wk6_sockets.pdf
...but my problem is being able to
view, fix, and add to code I haven't
written myself.
That is tough even for experienced programmers.
A book that might help you is Code Reading: The Open Source Perspective by Diomidis Spinellis.
Read The Art of Unix Programming ( TAOUP ). Its available online, well written and has lots of case studies that represent well designed programs. You may also find some good C++ opensource software amongst those case studies.
Apart from TAOUP, take a look at Boost C++ Libraries. They provide peer reviewed source libraries that are very well documented.
Another one, I have heard is Postfix ( an Open source email server for Unix ) that is said to have well written C++ code. Though, I must admit I do not have any direct experience with it.
Hope this helps :)