所以我无法垂直打印我的代码,无论我做什么,它都会继续水平打印。第一张图片是我的输出结果,第二张图片是它的样子。如何让代码垂直打印
// pixel counter
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
pixelcounter [s.nextInt()/ binwidth] += 1;
}
}
// histogram
for (int q = 0; q < pixelcounter.length; q++) {
if (binmin < 10) {
System.out.print(" " + binmin + ":");
} else {
System.out.print(binmin + ":");
}
int num_stars = (int) ((((double) pixelcounter[q] * 100.0/ area)) + 0.5)
for (i = 0; i < num_stars; i++) {
System.out.print("*");
}
System.out.println();
binmin += binwidth;
}
我应该认为这与JavaScript无关吗? – vlaz
此外,你正在使用'.print',你想'.println' – vlaz