java - how to get code to print vertically -
so having trouble printing code vertically, no matter do, continues print horizontally. first image how output looks , second image should be.
// pixel counter (y = 0; y < height; y++) { (x = 0; x < width; x++) { pixelcounter [s.nextint()/ binwidth] += 1; } } // histogram (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) (i = 0; < num_stars; i++) { system.out.print("*"); } system.out.println(); binmin += binwidth; }
you should use:
system.out.println(" " + binmin + ":"); if use system.out.print(" " + binmin + ":"); print in same line.
changing println make sure output printed on separate lines.


Comments
Post a Comment