C++ ! Create a Stash class specifically for storing Rect objects and call it Rec
ID: 3800393 • Letter: C
Question
C++ !
Create a Stash class specifically for storing Rect objects and call it RectStash. Add a default constructor and a destructor to correctly initialize your RectStash class. Then write a program that will read several lines as input. Each line will contain 4 floats defining a 2D rectangle in the Rect format described above. Read the rectangles adding them to a RectStash object. Stop reading rectangles when your program loads 4 negative float values. After this point you will start reading a series of 2D points, and for each 2D point you will print the classification of each point in respect to all previously read rectangles. The classification should print "in" or "out" according to its result. Stop your program when you read vector (-99,-99).
Everything should be contained in one file. You may not assume the existance of any header files in your working directory.
Sample Input:
-5 -5 2.5 2.5
5 8 2 2
-1 -1 -1 -1
0 0
-4 -6
6 9
-99 -99
result:
out out
in out
out out
Explanation / Answer
# include # include # include # include void show_screen( ); void Rectangle(constint,constint,constint,constint); void Line(constint,constint,constint,constint); int main( ) { int driver=VGA; int mode=VGAHI; int x_1=0; int y_1=0; int x_2=0; int y_2=0; do { show_screen( ); gotoxy(8,10); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.