POV-Ray : Newsgroups : povray.off-topic : Learning C++ Server Time
7 Sep 2024 03:22:00 EDT (-0400)
  Learning C++ (Message 8 to 17 of 57)  
<<< Previous 7 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Darren New
Subject: Re: Learning C++
Date: 11 Dec 2008 23:19:51
Message: <4941e667$1@news.povray.org>
nemesis wrote:
> Well, in that case:
> 
> http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
> 
> But you probably already know of that.  :)

Thanks. Already downloaded it, haven't waded thru it very far. :-) I've been 
finding motivation a bit hard to come by lately.

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: Kevin Wampler
Subject: Re: Learning C++
Date: 12 Dec 2008 00:08:21
Message: <4941f1c5$1@news.povray.org>
Darren New wrote:
> Sadly, I'm utterly uninspired about what to write past my first usual 
> program, namely "Jotto".  Any suggestions?

How about a program that takes a multivariate polynomial as input and 
determines if it has any roots over the integers ;-)


Post a reply to this message

From: Darren New
Subject: Re: Learning C++
Date: 12 Dec 2008 00:36:46
Message: <4941f86e$1@news.povray.org>
Kevin Wampler wrote:
> How about a program that takes a multivariate polynomial as input and 
> determines if it has any roots over the integers ;-)

I know you're joking, but I'm not sure how that would be more useful in 
learning C++ than in learning C.

-- 
   Darren New, San Diego CA, USA (PST)
   The NFL should go international. I'd pay to
   see the Detroit Lions vs the Roman Catholics.


Post a reply to this message

From: Kevin Wampler
Subject: Re: Learning C++
Date: 12 Dec 2008 00:48:21
Message: <4941fb25$1@news.povray.org>
Darren New wrote:
> Kevin Wampler wrote:
>> How about a program that takes a multivariate polynomial as input and 
>> determines if it has any roots over the integers ;-)
> 
> I know you're joking, but I'm not sure how that would be more useful in 
> learning C++ than in learning C.

It wouldn't really, I was just unable to resist giving an undecidable 
problem as a programming suggestion.

As a more serious suggestion, and somewhat graphics related, you could 
implement an inverse-kinematics system.  It lends itself well to an OO 
approach, and IIRC there's a clever technique to perform automatic 
differentiation using C++ templates that might give you some practice there.

Alternatively, how about implementing the Barnes-Hut algorithm for 
N-body simulations?  It should give pretty animations and I don't think 
is terribly difficult.

In terms of the STL perhaps writing a simple calculator would be a 
reasonable task.  You can add whatever interesting functionality you 
like (variables, complex numbers, exact rationals, matrices, tensors, 
symbolic expressions, etc) so you can probably craft it to work whatever 
data structures you're least familiar with.

I'm not a C++ expert though, so others may have better suggestions.


Post a reply to this message

From: scott
Subject: Re: Learning C++
Date: 12 Dec 2008 03:23:08
Message: <49421f6c@news.povray.org>
> Sadly, I'm utterly uninspired about what to write past my first usual 
> program, namely "Jotto".  Any suggestions?

How about something to solve/play a game, like Sudoku, checkers, connect 4, 
poker etc.  Not a huge OO-based project, but certainly something to get 
started with.


Post a reply to this message

From: Severi Salminen
Subject: Re: Learning C++
Date: 12 Dec 2008 03:36:52
Message: <494222a4$1@news.povray.org>
> Sadly, I'm utterly uninspired about what to write past my first usual
> program, namely "Jotto".  Any suggestions?

I was in the exact same situation as you. It depends on your past
programming experience. I knew Assembly and C and wanted to learn C++. I
first started a simple physics simulation "game". It showed bunch of
balls bouncing on the screen. Then I turned it into a 3D path tracing
renderer.

So: write a rendering engine!

Writing a chess engine was also fun.


Post a reply to this message

From: Invisible
Subject: Re: Learning C++
Date: 12 Dec 2008 04:23:05
Message: <49422d79@news.povray.org>
>>> How about a program that takes a multivariate polynomial as input and 
>>> determines if it has any roots over the integers ;-)
>>
>> I know you're joking, but I'm not sure how that would be more useful 
>> in learning C++ than in learning C.
> 
> It wouldn't really, I was just unable to resist giving an undecidable 
> problem as a programming suggestion.

Question: Why is this undecidable?

Surely it's a trivial matter of iterating over all integers and testing 
whether any of them is a root?


Post a reply to this message

From: Warp
Subject: Re: Learning C++
Date: 12 Dec 2008 07:49:11
Message: <49425dc7@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Sadly, I'm utterly uninspired about what to write past my first usual 
> program, namely "Jotto".  Any suggestions?

  Coding a small game is always fun, and a good environment for
object-oriented design (there are so many things in a typical game that
can be naturally expressed with classes, such as for example a sprite,
level data, etc.)

  OTOH one small problem with C++ is that there is no standard way of
drawing any graphics. Thus you'll have to resort to some third-party
library. The quality (as in C++ design quality) of existing libraries
is very varied, from usable to absolutely horrible. In my experience very
few C++ graphical libraries employ the same level of code design quality
as eg. the STL or the Boost libraries do, and they are often quite hard
to use, error-prone, and in some cases even buggy (there may be memory
leaks inside the library itself).

  There are two popular 2D engine libraries for Windows which I know of:

http://hge.relishgames.com/
http://developer.popcap.com/forums/pop_index.php

  I have only extensive experience on the latter one, and while it's not
horrible, it's not STL-level-of-quality either, and probably not the
easiest possible to use. From the example codes I have seen of the HGE
library, it might not be the easiest possible to use either.

  You could consider this one too, which would make your program much
more portable:

http://www.libsdl.org/

  However, I unfortunately have absolutely no experience in using it, nor
do I know how easy it is to integrate in Visual Studio. Being a C library
it will most probably be of a much lower level library than an abstract
high-quality C++ library would be, and consequently probably hard to use.
(OTOH, you said you do have a lot of experience with C.)

  You could try making DirectX or OpenGL code directly, but that would be
even lower-level code, and might become a nightmare. And you should forget
trying to program with the Windows API directly, unless you have *tons* of
experience with it, or you want to die prematurely.

-- 
                                                          - Warp


Post a reply to this message

From: Invisible
Subject: Re: Learning C++
Date: 12 Dec 2008 08:02:59
Message: <49426103$1@news.povray.org>
Warp wrote:

>   Coding a small game is always fun

This is the one thing I have never implemented. I'd like to do it at 
least once before I die...

>   OTOH one small problem with C++ is that there is no standard way of
> drawing any graphics.

...and this is the reason why. Almost *no* languages have the capability 
to easily draw graphics these days.

(Back when I was a kid, you could just say "plot 4, 7" and it would draw 
a dot there. Ah, I had no idea how good I had it!)

> And you should forget
> trying to program with the Windows API directly, unless you have *tons* of
> experience with it, or you want to die prematurely.

This made me actually laugh out loud. For real. Such a glowing 
recommendation of the Win32 API! :-D

(OTOH, I understand that the raw X Windows bindings are even harder... 
apparently... I guess that's why there's so many toolkits!)


Post a reply to this message

From: Mike Raiford
Subject: Re: Learning C++
Date: 12 Dec 2008 08:39:54
Message: <494269aa@news.povray.org>
Warp wrote:

> even lower-level code, and might become a nightmare. And you should forget
> trying to program with the Windows API directly, unless you have *tons* of
> experience with it, or you want to die prematurely.

My first C program was a program that used the Windows API directly... 
Your assessment is about accurate, though.

-- 
~Mike


Post a reply to this message

<<< Previous 7 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.