这种编程中合适的乳胶格式是什么?

问题描述 投票:0回答:1

最近,我正在练习以Latex格式编写。我在描述Latex中此类编程时遇到困难。将这段Java代码转换为伪代码是否合适,还是有更好的过程以Latex格式描述此代码?

public static void main(String[] args) {

    String list[] = new String[6];
    list[0] = "never give up";
    list[1]="never try to over smart";
    list[2]="i never give up any challenge putten from of me";
    list[3]="there is no gain without pain";
    list[4]="early to bed and early to raise makes a man health welthy and wise";
    list[5]="over smart is a sign of a looser";

    HashMap<String , Integer> hm = new HashMap();
    HashSet<String> words = new HashSet();

    for(int i=0;i<list.length;i++){
        String split[] = list[0].split(" ");
        for(int j=0;j<split.length;j++){
            if(hm.get(split[j])==null){
                hm.put(split[j], 1);
            }
            else if(split[j].length()>2){
                int x = hm.get(split[j]);
                x++;
                hm.put(split[j], x);

                if(x>=2){
                    words.add(split[j]);
                }
            }
        }
    }
   System.out.println(words);

}
java latex
1个回答
0
投票

你是说使用这个?

\begin{verbatim}
  Your code
\end{verbatim}
© www.soinside.com 2019 - 2024. All rights reserved.