📄 gcg5.c
字号:
/* Automatic code generation program
* Copyright Richard Heathfield 1999
* binary@eton.powernet.co.uk
*/
#include <stdio.h>
int main(void)
{
char *Lines[] =
{
"/* Automatic code generation program",
" * Copyright Richard Heathfield 1999",
" * binary@eton.powernet.co.uk",
" */",
"",
"#include <stdio.h>",
"",
"int main(void)",
"{",
" char *Lines[] =",
" {",
" \"/* Automatic code generation program\",",
" \" * Copyright Richard Heathfield 1999\",",
" \" * binary@eton.powernet.co.uk\",",
" \" */\",",
" \"\",",
" \"#include <stdio.h>\",",
" \"\",",
" \"int main(void)\",",
" \"{\",",
" \" char *Lines[] =\",",
" \" {\",",
" \" \\\"/* Automatic code generation program\\\",\",",
" \" \\\" * Copyright Richard Heathfield 1999\\\",\",",
" \" \\\" * binary@eton.powernet.co.uk\\\",\",",
" \" \\\" */\\\",\",",
" \" \\\"\\\",\",",
" \" \\\"#include <stdio.h>\\\",\",",
" \" \\\"\\\",\",",
" \" \\\"int main(void)\\\",\",",
" \" \\\"{\\\",\",",
" \" \\\" char *Lines[] =\\\",\",",
" \" \\\" {\\\",\",",
" \" \\\" \\\\\\\"/* Automatic code generation program\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" * Copyright Richard Heathfield 1999\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" * binary@eton.powernet.co.uk\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" */\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"#include <stdio.h>\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"int main(void)\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"{\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" char *Lines[] =\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" {\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"/* GCG - The code generator generator\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" * Copyright 1999 Richard Heathfield\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" * binary@eton.powernet.co.uk\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" */\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"#include <stdio.h>\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"#include <string.h>\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"int main(void)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"{\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" char *Intro[] =\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/* Automatic code generation program\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" * Copyright Richard Heathfield 1999\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" * binary@eton.powernet.co.uk\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" */\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"#include <stdio.h>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"int main(void)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"{\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" char *Lines[] =\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" };\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" char *Outro[] =\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" };\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" int LineCount = sizeof Lines / sizeof Lines[0];\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" int i;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", Lines[i]);\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" return 0;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" };\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" int LineCount;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" int i, ch;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" int AtLineStart = 1;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" LineCount = sizeof Intro / sizeof Intro[0];\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", Intro[i]);\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" while((ch = getchar()) != EOF)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" if(AtLineStart)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" AtLineStart = 0;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" if(ch == \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" AtLineStart = 1;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" else if(strchr(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", ch) != NULL)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" putchar(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" putchar(ch);\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" LineCount = sizeof Outro / sizeof Outro[0];\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", Outro[i]);\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" return 0;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"}\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" };\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" int LineCount = sizeof Lines / sizeof Lines[0];\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" int i;\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" {\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" printf(\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\", Lines[i]);\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" }\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\" return 0;\\\\\\\",\\\",\",",
" \" \\\" \\\\\\\"}\\\\\\\",\\\",\",",
" \" \\\" };\\\",\",",
" \" \\\" int LineCount = sizeof Lines / sizeof Lines[0];\\\",\",",
" \" \\\"\\\",\",",
" \" \\\" int i;\\\",\",",
" \" \\\" for(i = 0; i < LineCount; i++)\\\",\",",
" \" \\\" {\\\",\",",
" \" \\\" printf(\\\\\\\"%s\\\\\\\\n\\\\\\\", Lines[i]);\\\",\",",
" \" \\\" }\\\",\",",
" \" \\\"\\\",\",",
" \" \\\" return 0;\\\",\",",
" \" \\\"}\\\",\",",
" \" };\",",
" \" int LineCount = sizeof Lines / sizeof Lines[0];\",",
" \"\",",
" \" int i;\",",
" \" for(i = 0; i < LineCount; i++)\",",
" \" {\",",
" \" printf(\\\"%s\\\\n\\\", Lines[i]);\",",
" \" }\",",
" \"\",",
" \" return 0;\",",
" \"}\",",
" };",
" int LineCount = sizeof Lines / sizeof Lines[0];",
"",
" int i;",
" for(i = 0; i < LineCount; i++)",
" {",
" printf(\"%s\\n\", Lines[i]);",
" }",
"",
" return 0;",
"}",
};
int LineCount = sizeof Lines / sizeof Lines[0];
int i;
for(i = 0; i < LineCount; i++)
{
printf("%s\n", Lines[i]);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -