如何编写伪代码

时间:2010-10-14 08:47:31

标签: c# asp.net sql-server vb.net

使用VB.net,C#和SQL Server

我想为我的应用程序编写一个伪。

伪代码就像编码或流程图......?

任何人都可以为任何类型的应用程序提供示例伪代码。

4 个答案:

答案 0 :(得分:6)

这是一种编写伪代码的算法:

  

用你自己的话写下

答案 1 :(得分:2)

我认为这会有所帮助:

http://en.wikipedia.org/wiki/Pseudo-code

特别地:

  

伪代码语法没有标准   存在,作为伪代码中的程序   不是可执行程序。伪代码   类似,但不应该混淆   与,骨架程序包括   虚拟代码,可以编译   没有错误。流程图可以   被视为图形替代品   伪代码。

答案 2 :(得分:2)

伪代码只是表达程序意图而不是语法正确的一种方式。

一个例子可能是:

print "What is your name"
read input from user
print "Hello " + user input

从ATM取款的另一个例子:

if the selected account's balance is greater than the requested amount
    reduce balance by requested amount
else
    display error message
end if

答案 3 :(得分:1)

伪代码应该是代码的自然语言,例如:

while there are items left to process
   process the current item
   remove the item from the collection