You are not logged in.
Pages:: 1
#1 2015-06-12 10:48:29
Pseudocode
What is Pseudocode?
Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool.
Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading.The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented. These include while, do, for, if, switch. Examples below will illustrate this notion.
Example:
NEVER ANY DATA DECLARATIONS IN PSEUDOCODE
Print out appropriate heading and make it pretty
While not EOF do:
Scan over blanks and white space until a char is found
(get first character on the line)
set can't-be-ascending-flag to 0
set consec cntr to 1
set ascending cntr to 1
putchar first char of string to screen
set read character to hold character
While next character read != blanks and white space
putchar out on screen
if new char = hold char + 1
add 1 to consec cntr
set hold char = new char
continue
endif
if new char >= hold char
if consec cntr < 3
set consec cntr to 1
endif
set hold char = new char
continue
endif
if new char < hold char
if consec cntr < 3
set consec cntr to 1
endif
set hold char = new char
set can't be ascending flag to 1
continue
endif
end while
if consec cntr >= 3
printf (Appropriate message 1 and skip a line)
add 1 to consec total
endif
if can't be ascending flag = 0
printf (Appropriate message 2 and skip a line)
add 1 to ascending total
else
printf (Sorry message and skip a line)
add 1 to sorry total
endif
end While
Print out totals: Number of consecs, ascendings, and sorries.
Stop
You cannot discover the new oceans unless you have the courage to lose the sight of the shore.
Offline
2015-06-12 10:48:29
- Advertisement
- Ads By Google
Re: Pseudocode
\n
Pages:: 1