所以我一直试图解决这个问题一段时间。我尝试过的很多事情都失败了。有没有办法添加到我已经拥有的东西上?
for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {
int check;
int x, y;
// Prompt as follows
System.out.print("Enter value " + ii + ": ");
try {
c = Get();
}
catch (InputMismatchException e) {
input
System.out.println("Invalid input!");
ii--;
}check = c;
x = check; // I want to try to copy this
y = check - 1; // and copy this
min(x , y) // trying to acheive this
System.out.println(check + " " + x + " " + y);
}
对不起格式。这是我的屏幕。
Basically let us say user puts in 25 for first input. I want x = 25.
Then user inputs -11. I want y = -11.
Compare minimum z = -11.
then x = z = -11;
User input 33. y = 33
annd so on..
所以我最终得到了类似的东西
for(int ii = 1, j = 0; j <= copySel ; ii++, j++) {
int check;
int x = 0, y = 0, z;
// Prompt as follows
System.out.print("Enter value " + ii + ": ");
try {
c = Get();
}
catch (InputMismatchException e) {
System.out.println("Invalid input!");
ii--;
}check = c;
x = check;
z = x;
if (j % 2 == 1)
{
y = check;
Math.min(z, y);
}
System.out.println(check + " " + x + " " + y + " " + z);
}