User:A2569875/沙盒一
POST-COMPILING:
XCOPY "C:\Program Files\Common Files\MSVC\freeglut\bin\freeglut.dll" "$(OutDir)" /Y/D/K/C/I
#include <GL/glut.h>
/*------------------------------------------------
* Callback func of display event
* When the window shows up this procedure is called.
*/
void display(void)
{
/* set clear color to black and clear window */
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
}
/*-------------------------------------------------
* Callback function of reshape event
* w: new width of the window,
* h: new height of the window
*/
void my_reshape(int w, int h)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
}
/*------------------------------------------------
* Callback Function for keyboard events
* key: the key being pressed, x, y: current mouse position
*/
void my_keyboard(unsigned char key, int x, int y) {}
/*----------------------------------------------------
* Callback function for mouse-motion event.
* (x, y): current cursor position in the window
*/
void my_motion(int x, int y) {}
/*--------------------------------------------------
* Callback function for mouse event.
* button: GLUT_LEFT_BUTTON, GL_RIGHT_BUTTON, or GLUT_MIDDLE_BUTTON
* state: GLUT_DOWN or GLUT_UP
* (x,y): cursor position.
*/
void my_mouse(int button, int state, int x, int y) {}
/*--------------------------------------------
* The main procedure
*/
int main(int argc, char** argv)
{
/* Initialize mode and open a window in upper left corner of screen */
glutInit(&argc, argv); /* Make a connection to window system */
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); /* Set display mode */
/*----set window attribute ------*/
glutInitWindowSize(500, 500); /* window size */
glutInitWindowPosition(0, 0); /* initial position */
/*----create the window ---*/
glutCreateWindow("Enter Window Name");
/*----Associate callback functions with events--*/
glutDisplayFunc(display); /* display event */
glutReshapeFunc(my_reshape); /* reshape event */
glutKeyboardFunc(my_keyboard); /* keyboad event */
glutMouseFunc(my_mouse); /* mouse event */
glutMotionFunc(my_motion); /* motion event */
/*----Enter an infinite loop, and wait for events---*/
glutMainLoop();
}
#include <stdio.h>
#define COUNT 2
void po_print(int);
int getCount(void);
typedef char* string;
string code = "#include <stdio.h>%c#define COUNT %d%cvoid po_print(int);%cint getCount(void);%ctypedef char* string;%cstring code = %c%s%c;%cint main(void) {%c po_print(getCount());%c return 0;%c}%cvoid po_print(int count) {%c if (count > 0) {%c po_print(--count);%c printf(code, 10, getCount(), 10, 10, 10, 10, 34,%c code, 34, 10, 10, 10, 10, 10, 10, 10,%c 10, 10, 10, 10, 10, 10, 10, 10, 10);%c }%c}%cint getCount(){%c return COUNT;%c}%c";
int main(void) {
po_print(getCount());
return 0;
}
void po_print(int count) {
if (count > 0) {
po_print(--count);
printf(code, 10, getCount(), 10, 10, 10, 10, 34,
code, 34, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10);
}
}
int getCount(){
return COUNT;
}
after