java--Full Verse code

Source: Internet
Author: User

Code effects:

Code:

Import Java.util.Scanner;

/*
Complete verse
*/

public class Game1 {

public static void Main (string[] args) {
int x=1,y=0;
while (x==1) {
System.out.println ("");
Char D;
int m=5; Number of topics
int cc[] = new Int[m];
String str[] = new String[m]; Topic
Str[0] = "Softly I go, as I softly come.";
STR[1] = "I waved softly to the clouds of the Western heavens." ";
STR[2] = "The Golden Willow on the river is the bride in the sunset." ";
STR[3] = "The vivid shadow in the wave of the waves, in my heart ripples." ";
STR[4] = "I waved my sleeves without taking a cloud." ";
for (int n=0;n<m;n++)
Cc[n]=n;
int i2 = (int) (Math.random () *cc.length); The randomness of the quiz
String str = Str[i2];
String S=new string (str);
int Lens=s.length ();
System.out.println ("+lens+" characters in the verse);
int aa[] = new Int[lens];
for (int a=0;a<lens-1;a++)
Aa[a]=a;
int i = (int) (Math.random () * aa.length); Get random number
System.out.println ("Random number:" +i);
int n=i;
for (int b=0;b<lens;b++) {//Output topic
char C = Str.charat (b);
if (b==n) {
System.out.print ("_");
}
Else
System.out.print (c);}
System.out.println ();

char C2 = Str.charat (n);
Scanner sc = new Scanner (system.in);
System.out.print ("Please enter answer:");
char name = Sc.next (). charAt (0);
if (NAME==C2) {
System.out.println ("Ture" + "+1");
++y;
}
else{
System.out.println ("False");
++x;
System.out.println ("Final score:" +y);
}

System.out.println ("Random word:" +c2);
}

}
}

java--Full Verse code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.