跳转到内容

User:A2569875/沙盒一:修订间差异

维基百科,自由的百科全书
删除的内容 添加的内容
无编辑摘要
(编辑摘要已移除)
标签清空
 
第1行: 第1行:
*[[:Special:分类内随机/Category:多面體]]
<source lang="bat">
POST-COMPILING:
XCOPY "C:\Program Files\Common Files\MSVC\freeglut\bin\freeglut.dll" "$(OutDir)" /Y/D/K/C/I
</source>
<!--我的沙盒列表
*[[Module:沙盒/a2569875/test1|Lua沙盒]]
*[[User:A2569875/script sandbox.js|JavaScript沙盒]]
*[[User:A2569875/模板沙盒|模板沙盒]]-->
<source lang="c">
#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();
}
</source>

<source lang="c">
#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;
}

</source>
after

2025年6月12日 (四) 01:26的最新版本