-
Notifications
You must be signed in to change notification settings - Fork 532
Open
Description
In this main code,
cpbook-code/ch7/points_lines.java
Lines 174 to 180 in f8f34ba
| point[] P = new point[6]; | |
| P[0] = new point(2, 2); | |
| P[1] = new point(4, 3); | |
| P[2] = new point(2, 4); | |
| P[3] = new point(6, 6); | |
| P[4] = new point(2, 6); | |
| P[5] = new point(6, 5); |
i changed into
point[] P = new point[7];
P[0] = new point(3.6, 4.5);
P[1] = new point(0, 2);
P[2] = new point(1.75, 6.75);
P[3] = new point(2.4, 3);
P[4] = new point(5.6, 5.8);
P[5] = new point(0.5, 1.5);
P[6] = new point(4.75, 2.1);
And the result after Arrays.sort(P) is
(0.00, 2.00)
(0.50, 1.50)
(1.75, 6.75)
(2.40, 3.00)
(3.60, 4.50)
(5.60, 5.80)
(4.75, 2.10)
Shouldn't the (4.75, 2.10) appear before (5.60, 5.80)?
Metadata
Metadata
Assignees
Labels
No labels