Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: (C++ and other programming languages) Pseudocode  (Read 1166 times)

0 Members and 1 Guest are viewing this topic.
(C++ and other programming languages) Pseudocode
« on: September 05, 2006, 10:51:40 pm »
  • You don't know me.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 234
Yes, I was just making some Pseudocode and decided to randomly do a tutorial. I will be using C++ but you can use pseudocode for whatever as well.


So, suppose this was actually a very big program.

Code: [Select]
#include <iostream>

using namespace std;

int main()
{
      cout << "I'm a big program.\n";
      return 0;
}


Pseudocode is like a programming language in english. In pseudocode, that would be:

Code: [Select]
Say "I'm a big program."
Of course, you could write it like this as well:

Code: [Select]
write out "I'm a big program."
But, you want to make it really real language-y, so...

Another example would be initializing a variable called eaten. You could say:

Code: [Select]
Initialize eaten to 0.
So, just plan out your code in pseudocode and you won't make as many mistakes when actually writing the program. YAYYYY

Pseudocode is not a recognized programming language. Please do not try to compile pseudocode. It won't work. Vortex Inc. is not responsible if, by trying to compile Pseudocode, you trash your computer.
Logged


No one located in this area of the internet remembers me.
Re: (C++ and other programming languages) Pseudo...
« Reply #1 on: September 06, 2006, 04:00:22 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
Not exactly. Pseudocode is really more like writing out the code but leaving out specific details. Something like this (in GM)

Code: [Select]
draw_sprite(sprite,image,position);
x += view_xview + view width;
draw_set_color(orange color);
See, that wouldn't actually work, but you get what you have to do. You'd replace view width with view_wview, and position with "x,y" and orange color with the RGB values for orange.
Logged
Re: (C++ and other programming languages) Pseudo...
« Reply #2 on: September 06, 2006, 05:56:44 pm »
  • You don't know me.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 234
Well, two C++ books I have, both from different authors and publishing companies, say that it is writing it out as an English type... thing (Beginning C++ Game Programming and C++ for Game Programmers). Where did you hear that?
Logged


No one located in this area of the internet remembers me.

aab

^ Evolved from a Hobbit
Re: (C++ and other programming languages) Pseudo...
« Reply #3 on: September 06, 2006, 06:47:13 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
Its everything inbetween and including. Its what you want it to be - Just as long as its standardized within the one team of communicaters.

The point in pseudocode is that steps can be composite, and able to be broken, allowing it to be a simplified form, and that it can be read withought relying on the syntaxical constraint of a single language, such that any programmer should be able to understand it.
Scooternews example is bad pseudocode, but its acceptable and recognisable within the GM community.

It should also be a simple and clean thing, for example, indentation is sometimes used as the constraint of constructs in pseudocode:
Code: [Select]
Set flag: Beginning enemy update
For each enemy
    Update this enemy
Set flag: Finished enemy update


Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Re: (C++ and other programming languages) Pseudo...
« Reply #4 on: September 06, 2006, 08:34:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
Well yes aab, I'd have a different type of pseudocode for C++. But that's how its done often at the GMC.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.065 seconds with 44 queries.