# 有没有办法让用户在此数组中的问题之后立即输入答案？

``````// variables
double percCorrect= 0;
final int numberOfQuestions = 10;
double userGuess1;
double userGuess2;
double userGuess3;
double userGuess4;
double userGuess5;
double userGuess6;
double userGuess7;
double userGuess8;
double userGuess9;
double userGuess10;

// intro
System.out.println();

// array for questions
String [ ] questions = new String [10]; // questions = name of array, holds 10 string values (questions)

// assigning questions
questions[0] = "Question 1: (4 – 5) – (13 – 18 + 2) = ?";
questions[1] = "Question 2: What number is next in this sequence: 31, 30, 22, 21, 13, 12, __";
questions[2] = "Question 3: Round 3.864 to the nearest tenth";
questions[3] = "Question 4: If 3x = 6x - 15, then x + 8 = ?";
questions[4] = "Question 5: The value of x + x(x^x) when x = 2 is ?";
questions[5] = "Question 6: 20% of 2 = ?";
questions[6] = "Question 7: What number is next in this sequence: 0, 1, 1, 2, 3, 5, 8, __";
questions[7] = "Question 8: Two sides of a right angled triangle are 3 and 4. The third side is ?";
questions[8] = "Question 9: What's the degree of 7x + 5 ?";
questions[9] = "Question 10: Solve for x: 5x + 2(x + 7) = 14x – 7";

double [ ] answers = {2, 4, 3.9, 13, 10, 0.4, 13, 5, 1, 3}; // answers = name of array, holds 10 double values (answers)

// outputting questions
for (int i = 0; i <= 9; i = i + 1)
{
System.out.println(questions[i]); // outputting questions, eg when i = 0, system outputs questions[0]
} // end of for loop

System.out.println();
userGuess1 = keyedInput.nextDouble();

userGuess2 = keyedInput.nextDouble();

userGuess3 = keyedInput.nextDouble();
``````

``````// Question
// User's guess

// Next question
// User's guess
``````