Draw a right triangle on a 25x25 grid using two user-defined coordinates

Hello everyone, I have a homework assignment that requires the user to enter 4 numbers that make up two coordinates (x1, y1) and (x2, y2). The assumption is that a right triangle can be made using only these two coordinates where the 90 degree corner would theoretically be at (x2, y1). Right now I have a 25x25 grid using for loops shown below:

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
30
int main(){

        int x1, x2, y1, y2;
        char triChar;
        
        cout << "Enter the right triangle's two coordinates: ";
        cin >> x1, y1, x2, y2;

        cout << "Enter the character that will be used to draw the triangle: ";
        cin >> triChar;

        for (int y = 25; y >=0 ; y--){
		cout << y;
		for (int x = 0; x <= 25; x++){
			if (y == 0 ) {
				cout << " " << x+1;
			} else if (x >= 9) {
				cout << "  .";
			}
			else {
				cout << " .";
			}
			
		}
		cout << "\n" << endl;
	}

        return 0;     

}


What needs to happen is the user enters two sets of coordinates to make a right triangle and then needs to enter a character that will replace the dots of the grid to draw a right triangle. I'm having a difficult time getting this to work. Can anyone point me in the right direction?
I would suggest you to create a matrix that represents your canvas. Draw in your matrix and then print it.

¿what part is giving you trouble and what are you supposed to learn from this task?
The part I'm having trouble with is knowing how to use my coordinate variables (x1, x2, y1, y2) with the 'for' loops. Could they be inserted in the loops somehow to make this work? We haven't learned about matrices yet so I'm not sure how to go about that without further research.

As for what I'm supposed to gain from this assignment, I don't know. We're currently learning about templates and inheritance in class so I don't know why this was assigned. Maybe just for extra problem solving practice? haha
Topic archived. No new replies allowed.