I am trying to use an array, but I am not sure if that is the right way to do this.
I want the first and second integer input to compare with one another, then if there are more they compare with each other.
So here is the piece of the code.
for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {
int x = 0;
int[x] check;
// Prompt as follows
System.out.print("Enter value " + ii + ": ");
try {
c = Get();
}
catch (InputMismatchException e) {
// Display the following text in the event of an invalid input
System.out.println("Invalid input!");
ii--; x--;
} check = c; x++;
System.out.print(check + " "+ x);
}
My actual format is not this bad. I need to try to find the minimum value depending on the number of integer the user has input
static int Get()
{
Scanner intFind = new Scanner(System.in);
int select;
select = intFind.nextInt();
return select;
}
This is Get() ^
cant I use min(x, y) continuously?