It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                7年前关闭。
            
        

 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);
    }


您如何将这样的东西转换为伪代码?例如

String s = "";


伪代码会是这样吗?

Set s to ""


对我而言,这似乎是错误的。

有什么帮助吗?谢谢

最佳答案

我认为伪代码没有预定义的语法。只需遵循两个规则:


它应该是普通的英语,具有常见的编程结构。
它应该是通用的,而不是特定于任何语言。


以下内容适合:

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 - Java中的伪代码? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13954276/

10-11 14:35