Questuin about coding

in program below i wish to dispaly 2 Line , which can be adjusted by input angles. at mean time , the angle can change position of the triangle and a retangle in 2 viewport .
eg , enter the angle (0-360)

diplay 2 shape : rectangle and trangle with that angle

#include <stdlib.h>
#include <glut.h>
#include <math.h>
#define _USE_MATH_DEFINES
#include <iostream>

using namespace std;

GLint displayWindowWidth = 800, displayWindowHeight = 400;
GLint xmin = -400 , xmax =400 , ymin=-400, ymax=400;
float angle = 0;
float degreesToRadians(float angle)
{
return angle * M_PI / 180.0;
}

void init()
{
glClearColor(1,1,1,0);
glMatrixMode(GL_PROJECTION);

gluOrtho2D (xmin,xmax,ymin,ymax);

glMatrixMode(GL_MODELVIEW);

}

void display()
{
glClear(GL_COLOR_BUFFER_BIT);

glViewport(0, 0, 400, 400);
float dx = cos(degreesToRadians(angle)) * 200;
float dy = sin(degreesToRadians(angle)) * 200;

glColor3f(1,1,0);
glBegin(GL_LINE);
	glVertex2f(-400,0);
	glVertex2f(400,0);
glEnd;

glColor3f(0, 0, 1);
glBegin(GL_POLYGON);
glVertex2f(dx-50, dy);
glVertex2f(dx, dy+200);
glVertex2f(dx+50, dy);
glEnd();
glFlush();

}

void winReshapeFcn (int newWidth, int newHeight)
{
glMatrixMode (GL_PROJECTION);
glLoadIdentity();

gluOrtho2D (xmin, xmax, ymin, ymax);

glMatrixMode (GL_MODELVIEW);
glLoadIdentity();

glClear (GL_COLOR_BUFFER_BIT);

}
int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(100,100);
glutInitWindowSize(displayWindowWidth, displayWindowHeight);
glutCreateWindow(“2D viewing system”);

cout &lt;&lt; "Enter an angle in degrees (0 - 360): ";
cin &gt;&gt; angle;
cout &lt;&lt; endl;


init();
glutDisplayFunc(display);
glutMainLoop();

return 0;

}

Have a look at glRotate and glTranslate; I think this is what you want