単語/フレーズをチェックして、その中の母音がアルファベット順か逆アルファベット順かを言わなければなりません。私はそれを手に入れるのにとても近いです。配列内の数値を比較して、それらが降順であるかどうかなどを確認する最後のビットです。ネストされた for ループを作成する必要があることはわかっていますが、正確な方法はわかりません。助けてくれてありがとう。
public static void main(String [] args)
{
String result = "", result2="";
String userInput = "aeiou";
int [] array = new int[userInput.length()];
for(int i = 0; i < string.length(); ++i)
{
char c = replace.charAt( i );
int j = (int) c;
array[i] = j;
//printing unicode symbols (only for testing)
result2 += array[i] +",";
System.out.println(j);
}
boolean sequence = false;
for(int i = 0; i <array.length-1 && !sequence; i++)
{
for(int x =i+1; x<array.length; x++)
{
//Here I am checking to see whether or not they are in alphabetical order
if(array[i] < array[x])
sequence = true;
if(sequence == true)
result = "The vowels are in alphabetical order";
else
result = "The vowels are not in alphabetical order";
}
}
System.out.println(result);
}