diff --git a/Dot.o b/Dot.o new file mode 100644 index 0000000..7f9b3a3 Binary files /dev/null and b/Dot.o differ diff --git a/Paint b/Paint new file mode 100755 index 0000000..bb5450a Binary files /dev/null and b/Paint differ diff --git a/main.cpp b/main.cpp index 335c031..0410fcf 100755 --- a/main.cpp +++ b/main.cpp @@ -210,14 +210,16 @@ void drawRectangle(int x1, int y1, int x2, int y2) drawLine(x2, y2, x1, y2); drawLine(x1, y2, x1, y1); } + else { - time_t rawtime; - struct tm *timeinfo; - time(&rawtime); - timeinfo = localtime(&rawtime); - std::cout << asctime(timeinfo) - << "[Warning] The first click should be the top-left corner, the second click should be bottom-right corner.\n"; + int t1 = x1; + int t2 = y1; + x1 = min(x1, x2); + y1 = min(y1, y2); + x2 = max(t1, x2); + y2 = max(t2, y2); + drawRectangle(x1,y1,x2,y2); } } diff --git a/main.o b/main.o new file mode 100644 index 0000000..44f517f Binary files /dev/null and b/main.o differ