pseudocode for functions

This is a discussion on pseudocode for functions within the C++ Programming forums, part of the General Programming Boards category; What is the standard or convention for functions in speducode For example I have this. Would I specifically declare the ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    141

    pseudocode for functions

    What is the standard or convention for functions in speducode

    For example I have this. Would I specifically declare the variables as is? My attempt is below

    Code:
    void CB1::midpointline(int x0,int y0, int x1, int y1, CDC *pDc)	
    {
    	int dx,dy,incrE,incrNE,d,x,y;
    
    	dx=x1-x0;
    	dy=y1-y0;
    	d=dy*2-dx;
    	incrE=dy*2;
    	incrNE=(dy-dx)*2;
    	x=x0;
    	y=y0;
    
    }
    Code:
    Create function mindpointline(StartPoint x0 , StartPoint y0 , EndPoint x1 , EndPoint y1 , Pointer to Device Context)
    
       Set Delta(X) to x1-x0
       Set Delta(y) to y1-y0
       Set decision to 2*dy-dx
       set Delta(E) to dy*2
       set Delta(NE) to 2*(dy-dx)
       set x to equal x0
       set y to equal y0
       Draw pixel with X and Y values
    
    End functiojn

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,528
    There is no convention when it comes to pseudo code...[afaik]..
    Are you speaking about functional programming?..which looks similar but has strict syntax rules..
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    C++ Junkie Mozza314's Avatar
    Join Date
    Jan 2011
    Location
    Australia
    Posts
    174
    Personally, I don't bother with pseudocode. If you want to write something concrete that makes sense, that's what the language itself is for. I can see some potential for merit for roughly sketching out bigger ideas, but an almost one-to-one mapping to actual C++ routines? A waste of time I say.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,646
    The whole point of pseudocode is that it is written to convey basic understanding of (say) an algorithm for a human. It is not real code (hence the pseudo in its name) because it is not precise enough to be used as instructions for a computer (or as input for a compiler).

    Humans are pretty flexible in what they can read and write, so there are almost as many styles of pseudocode as there are people who use it.
    Last edited by grumpy; 04-17-2011 at 05:17 AM.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pseudocode ?
    By sarajko in forum C Programming
    Replies: 1
    Last Post: 11-19-2010, 06:40 AM
  2. pseudocode
    By samsung in forum C Programming
    Replies: 8
    Last Post: 10-28-2007, 01:46 PM
  3. writing the pseudocode........functions
    By bajan in forum C++ Programming
    Replies: 3
    Last Post: 04-15-2005, 01:59 PM
  4. URGENT Pseudocode help!!!
    By mcgeady in forum C Programming
    Replies: 10
    Last Post: 11-17-2004, 09:03 PM
  5. help with pseudocode?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 08-11-2002, 07:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21