java中的伪代码? [英] Pseudocode in java?
本文介绍了java中的伪代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
String s = "";
myf = new Finch();
do
{
//Run the menu until quit or cancel is selected
s = FinchMenu();
//menu 1
if (s.equals("Back and forward")) RunAccelerationTest(s);
}
您如何将这样的内容转换为伪代码?例如
How would you convert something like this to pseudocode? For instance
String s = "";
它的伪代码是这样的吗?
Would the pseudocode for it be something like this?
Set s to ""
这对我来说似乎是错误的.
That just seems wrong to me.
请问有什么帮助吗?谢谢
Any help please? Thanks
推荐答案
我认为伪代码没有预定义的语法.只需遵循两个规则:
Pseudocode, i think, doesn't have a predefined syntax. just follow two rules:
它应该是简单的英语,带有常见的编程结构.
It should be plain english with common programming constructs.
它应该是通用的,而不是特定于任何语言.
It should be generic, not specific to any language.
以下应该适合:
Step 1: Initialize an empty string. (say str)
Step 2: Construct a new 'Finch' object.
Step 3: BEGIN LOOP
Fetch 'FinchMenu' from 'Finch' object.
assign 'FinchMenu' to 'str'
IF 'FinchMenu' is "Back and forward"
Call 'RunAccelerationTest' method with 'str' as argument.
END IF
END LOOP
这篇关于java中的伪代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文