As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Does anyone know any site or book that presents problems like python challenge, but for C++?
When I think python challenge, I do not mean only a set of problems to be solved with C++ (for that I could probably use the same problems of python challenge), but rather problems that will probably be best solved using C++ STL, special features of the language, etc.
For example, there is one python challenge that is specifically designed to teach you how to use pickle, a serializing library for python.
Until now, I only know programming contests problems, but they could also be solved with C, java or other languages.
You might like to have a look at Herb Sutter's Guru of the Week series of articles.
Google Code Jam problems frequently have analyses with snippets of C++ code, probably because C++ is by far the most popular language used for solving code-jam problems. The latter also allows you to see many C++ constructs cleverly employed, as code-jam allows you to download the solutions by all the competitors. As most code is C++, you'll get to learn a lot of nice C++ tricks for efficient code.
There are many tasks on Rosetta Code that are not implemented in C++ as yet. Try your hand at those, especially if you can use advanced features (templates, external libraries, etc.) to produce a particularly nice solution. Remember that there is no fundamental reason why any of those tasks should be beyond the C++ language, and there's usually several other implementations in other languages to show you other ways to attempt the task, which can help a lot.
You're going to have a difficult time finding that because C++ provides less for you than almost any other language available. If C++ provides it, it's probably provided by Python or Java or C or any other programming language.
Why not try using some C++ concepts such as the STL to solve Project Euler problems?
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I would like to walk the path of functional languages, since i have started i have only used OO languages and multi-paradigm languages; in the last period of time i have focused myself on C++ and in my understanding functional languages shines when you need to keep a consistent state and they are often used by some mission-critical services like banking services.
I don not want to leave C++, I would like to try a mix, I'm also interested only in cross-platform solutions among x86, ARM and Linux, Windows and BSD/Mac, so i suppose that F# is out ( also it appears to be just the Microsoft version of Ocaml for what i have read).
Can you suggest a language that will be good for this mix and clarify where and when a functional language can really offer the most ?
If you're interested in a language which is similar to C++ (with good C/C++ interoperability, too), but has powerful constructs from functional languages, you might like Rust. One of the Rust developers wrote up a comparison of Rust's and C++'s goals, which you might find informative.
Support for ARM does not yet exist, but Rust is LLVM-based, and LLVM supports ARM, so it's certainly possible to do.
Use C++11 lambda functions and expressions ;)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I have been coding in java most of the time, and I also studied C and C++ at University. But I have never written a large C++ code from zero made of many files, as I have done in java with a file for each class.
I'd like to know some book or reference with exercises and examples made of many files and classes en C++, so I can face big C++ projects in the future.
Sorry if you feel this question is eternally repeated.
Large-Scale C++ Software Design, by John Lakos.
Frankly, it doesn't matter much which language you're using in the end. Good software design is good software design. I don't think you'll ever learn it from a single book - and most books that talk about that kind of thing are referring to designing large frameworks which I doubt you're doing.
Identify sub-components/functionalitities in your requirements that you can form into separate libaries (static or dynamic, read up on the difference). If you compartmentalize these components into libraries that can act independently of each other then you'll have loose coupling between libraries - and assuming you've correctly identified your sub-components, they should have high-cohesion (everything in a library is closely related).
Try and keep dependencies out of your header files whenever possible regardless of where you're coding - you should read up (even on google) about separating declaration from definition). There's a number of design patterns for this purpose (including PIMPL which I seem to be mentioning alot today).
Read the design patterns book by the Gang-of-Four, and do the above, and you'll be off to a good start. Also, assuming you're decent with C++, Effective C++ by Scott Meyers will talk about some of these topics in very helpful manners.
Good design is a key on large projects and it is doesn't matter which language do you use if you follow the OO concept.
But for some best practices in c++ you could read this book:
http://www.gotw.ca/publications/c++cs.htm
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
This question may seem to be naive.
But I think it'll be much worse if I don't ask it at all.
When a discussion begins about the features of Python that the developers love the most, they usually mention list comprehension, syntax relying on indentation (thus avoiding brackets, etc.) and some other.
At such moments I ask myself a question why there can't be made a language based on C++ but having a syntax like in Python and having all the features like list comprehensions, generators.
I understand that such a language won't have all the features that Python has, e.g. eval or exac statements (because they rely on Python being an interpreting language), may be some others that I don't know of.
But I also know that there is a project called Shedskin which makes a C code of a Python code (with some restrictions on what can be used in Python code).
So, are there some real reasons why it's impossible to create such a language that will combine all the best features of Python and a very fast code that produces C++? Or it's just the turn of events that Python for some reasons became very popular and it turned out to be interpreted, so a lot of people use it for its greatest features still discontent at the speed of the code, and some of them struggle to create something (like Shedskin or Psyco) to speed it up?
Google as created a language called Golang ( or Go). It is a compiled language with python like syntaxe. There are alot of video and documenttation that will answer your question there.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I know this could be seen as subjective off-the-cuff (thus a poor question), but bear with me.
Boost has recently become available on the project on which I'm working, and I don't have much experience with it. Boost has so many parts and features that it's hard to know where to get started in learning it - especially since I'll be trying to learn it while making production code.
So, I would greatly appreciate it if someone could list around 3 to 5 features which are very useful in general, every-day programming and state why they're useful. I'm not asking you which is best, or trying to get a debate - I just want to know some good features to start learning and using immediately. I don't need code samples either, I'll be more than happy to research how to use the features myself after I know which ones are sensible to start learning now.
I'll accept any answer with a concise list of features that are sensible :)
format and lexical_cast are great for string manipulation, I find them invaluable. I use them every day.
bind is great for ad hoc functors, you'll find it is reused throughout many of the boost libraries.
multi_index fills the gap of when you need the same data in two search structures at once, it is very handy at times. Keep it out of your headers though.
type_traits defines useful traits for template specializations.
signals is a signal/slot mechanism implementation, great for event driven designs.
shared_pointer is critical. It lets you automatically handle memory usage.
http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/shared_ptr.htm
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
c or c++??
if i want to make a project on pattern recognition( artificial computing)
using c or c++
which one should i choose??
Object Oriented Programming can probably be of some help if you start programming something complex. That is possible with C but will probably be easier using C++. That said there is a risk to get lost on the multitude of features of the language if you are just learning it, and it's probably less so with C. But it's not so hard to use only a subset of C++, so definitely C++.
The most important point is that you should first focus on the problem(s) to solve before focusing on the tools you are using.
I would use something high level so you could learn about your own algorithms and not how to implement your algorithms. If you can write pattern recognition single handedly in C I applaud you. It is beyond my skill.
Perhaps Ruby or Python then implementing the computationally expensive parts in native C?
Since C++ is effectively a superset of C, there is no good reason not to use C++.
I think that is the least of your worries. C is available on more platforms, C++ has more features.