Pseudocode: a clear definition?
Posted
by Cian E
on Stack Overflow
See other posts from Stack Overflow
or by Cian E
Published on 2010-03-22T02:43:47Z
Indexed on
2010/03/22
2:51 UTC
Read the original article
Hit count: 634
pseudocode
|definition
The following code is an example of what I think would qualify as pseudocode, since it does not execute in any language but the logic is correct.
string checkRubric(gpa, major)
bool brake = false
num lastRange
num rangeCounter
string assignment = "unassigned"
array bus['business']= array('person a'=>array(0, 2.9), 'person b'=>array(3, 4))
array cis['computer science']= array('person c'=>array(0, 2.9), 'person d'=>array(3, 4))
array lib['english']= array('person e'=>array(0, 4))
array rubric = array(bus, cis, lib)
foreach (rubric as fieldAr)
foreach (fieldAr as field => advisorAr)
if (major == field)
foreach (advisorAr as advisor => gpaRangeAr)
rangeCounter = 0
foreach (gpaRangeAr as gpaValue)
if (rangeCounter < 1)
lastRange = gpaValue
else if (gpa >= lastRange && gpa <= gpaValue)
assignment = advisor
brake = true
break
endif
rangeCounter++
endforeach
if (brake == true)
break
endif
endforeach
if (brake == true)
break
endif
endif
endforeach
if (brake == true)
break
endif
endforeach
return assignment
For the past couple of weeks I've been trying to create a clear definition of what pseudocode actually is. Is it relative to the programmer or is there an actual clearcut syntax? I say pseudocode is any code that does not execute, how about you? Thanks (links to this subject welcome)
© Stack Overflow or respective owner