Having trouble moving my square.

Having trouble getting my square to move to the left my code and instructions of what i am suppose to do is below. No sure how to move my square or if I am even going in the right direction as to writing code to do so. Note that it is only part of my code ( part 2 of project)

Part 2:

Write a graphical application that draws a square and then moves it.

Get the x and y coordinates for the top left corner of the square from the user using the get_int() member function of cwin. Get the length of a side of the square from the user using get_int() as well. Now draw the square to cwin according to the user input.Ask the user how many units to the left they want to move it using get_int() again. Then move the square, clear the screen, and draw it again.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
	// Part 2 //
	/* command output to declare the x,y value  and 1 side length of a square  through user interaction( Has user input intergers) */
		int x_value = cwin.get_int("What is the x_value of the top left of the square?");
		int y_value = cwin.get_int("What is the y_value of the top left of the square?");
		int side_length = cwin.get_int("Input the length for one side of the square:");
		
	    /* Data type for the 4 corners of the square */	    	    
		Point e;
		Point f;
		Point g;
		Point i;

		/* Lines to create square(connects lines using points of square from information user inputs) */
		Line t(e,i);
		Line n(e,f);
		Line t1(f,g);
		Line n1(i,g);
		
		/* command to connect lines to form square */
		cwin << h << v << h1 << v1;

		/* allow user to input how many units for square to move to the left */
		int shift_left = cwin.get_int("How many units would you like to move the square to the left?");
		
		t.move(-5,5);
		n.move(-5,-5);
		t1.move(-5,-5);
                n1.move(-5,-5);
		cwin << t << n << t1 << n1;

Topic archived. No new replies allowed.