Advertisement

Basic functions question

Started by March 01, 2002 06:21 PM
6 comments, last by sanguineraven 22 years, 8 months ago
i have only really programmed in pascal, where i used procedures and functions and have started learning c++ right from basics, i have only found tutorials on Functions. do procedures exist in c++ or do i just use functions? What about me? What about Raven?
oh and also after the basic commands, any REALLY good tutorial places cos i can no way afford programming books, most of them are like £40+

I would particularly be interested in places with help/tutorials/as in depth description as possible for tetris, breakout, pong or pacman

What about me? What about Raven?
Advertisement
Hmm... First off, may I suggest the book "C++ in plain english." its cheap (about $20 US, 18 pounds UK), easy to understand, and fairly comprehensive. Having never studied Pascal, I can''t honestly answer the question concerning procedures, since i dont know what the hell they are. To my knowledge, however, it seems that one would not need procedures, since functions in C++ are pretty much all purpose. C, the language C++ is a superset of, is based purely on functions. If procedures are like subprograms in BASIC or assembly, you probably wouldn''t need procedures, since you could just call a function with no parameters.
Heh heh heh...fresh meat.

I haven''t coded in PASCAL, but I''ve piddled around in BASIC, and I''d say yeah, procedures are a lot like functions.

Functions allow you to split up your program up into manageable chunks, the whole premise of non-procedural programming.

You''ll want to learn OOP eventually of course, to take full advantage of the C++ language.

To get started, go here:
C/C++ Programming Tutorials

Unless you''ve been coding games in Pascal, don''t expect to be able to code games in C++ right away. There''s a lot to learn, but once you develop a little bit of competency, you can try "Game Programming Genesis," a series by Joe Fernald, I believe. You''ll find in in the Articles section.

G''luck,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

[twitter]warrenm[/twitter]

yeah so far ive been using that site for tutorials, bout half way through, but decided to stop at pointers for a bit

yeah procedures are basically subprograms and yeah as i now understand and have found, its just a function with no parameters.

What about me? What about Raven?
A procedure is simply an out-of-line code block. Although C++ does not have something specifically called "procedure", it is basically the same as a function taking no arguments and returning void. For example:

  void procedure(void){  // do some stuff  // do some more stuff}  


--
You see some pale bulbous eyes staring at you.
Advertisement
I think the only difference between function/procedure in Pascal and funtions in C++ is the return type, not parameters and return type. Procedures in Pascal are functions that don''t return anything. In C++ this is done by specifying void as the return type.
You might be right there. I haven''t touched Pascal for about 10 years, so I have to admit to more than a little rustiness.

--
You see some pale bulbous eyes staring at you.

This topic is closed to new replies.

Advertisement