LoginSignup
7
7

More than 5 years have passed since last update.

Javaでズンドコシステム

Posted at

元ネタ:



大学の課題で遂に出たのでやってみた。
zundoco.java
public class zundoco {
    public static void main(String[] args) {
        String word[] = {"ズン","ドコ"};
        String current = "";
        int r ;
        for (int i =0 ; ; i++){
            if (current.lastIndexOf("ズンズンズンズンドコ") > 0){
                System.out.print("キ・ヨ・シ!");
                break;
            }else{
                r = (int)(Math.random()*10);
                if (r < 5){
                    current += word[0];
                    System.out.print(current);
                }else{
                    current += word[1];
                    System.out.print(current);
                }
            }
        }
    }
}
7
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7