?'??'??'? ??. wrote:
I am a c++ beginner and i have finished the book c++primer. I am
looking forward to turning what i have learned into practice but i
am now confused and don't know what to do next. i am wondering if
there is some small projects that are suitable for me? i know c++
alone may not be enough as it may involves other fields of
knowledge such as networking. If it does, can you recommend some
books for it? thank you!!
On 2 Jul., Pavel wrote:
Ideally you have to come up with something from the domain area you
know. This way, you first simplify it to death but when your very
first little project is done (it may be as simple as 30 lines of
code), you would have a million ideas on what you want to add to it.
Nobody from outside can give you this -- only yourself or people who
know you and your background because:
1. The key to success is to be interested in the result of the
project and no one knows your interests better than you do (or maybe
people who know you well and for long time).
2. Working in the area you do not know or not interested in you risk
foraying into easy paths or artificial exercises prompted by the
programing language (your choice of C++ practically guarantees you
tons of distractions of both kinds) and impeding your progress in
learning how to apply it to real-world problems.
Pavel is right. However, it may be difficult for you to choose some
project to get your hands wet since you have only just started to
write code (I guess). So I think it won't hurt to give you some task
that is quite small, but still complex enough to use more
sophisticated features of C++. Here we go:
Write a console-based application that computes mathematical functions
and its derived functions. The first implementation should use a
function that is hard-wired into main (you should not be bothered with
I/O in the first stage, you can add this later on). The function
interface should look like this:
class Function
{
public:
virtual ~Function () {}
virtual double Compute (double x) const = 0;
virtual Function* Derive () const = 0;
//
// Whatever additional methods that are required for
// technical reasons (you have to figure for yourself).
//
};
Your main should look like that:
int main ()
{
Function* f;
//
// some code that assigns f to the function x->3*x^2
//
std::cout << f->Compute (5.0) << std::endl;
std::cout << f->Derive ()->Compute (0.3) << std::endl;
}
The result should then be
75
1.8
This task is actually from a course for high school students.
Regards,
Stuart