|
发表于 2005-3-31 20:34:45
|
显示全部楼层
- char *str="int main()\n"
- "{\n"
- " char *p;\n"
- "\n"
- " printf("char *str=%c", 34);\n"
- " for (p=str; *p; p++) {\n"
- " if (*p == 34)\n"
- " printf("%c%c", 92, *p);\n"
- " else if (*p == 10)\n"
- " printf("%cn%c%c%c", 92, 34, 10, 34);\n"
- " else\n"
- " putchar(*p);\n"
- " }\n"
- " printf("%c%c%c%c%s%c", 34, 59, 10, 10, str, 10);\n"
- "\n"
- " return 0;\n"
- "}";
- int main()
- {
- char *p;
- printf("char *str=%c", 34);
- for (p=str; *p; p++) {
- if (*p == 34)
- printf("%c%c", 92, *p);
- else if (*p == 10)
- printf("%cn%c%c%c", 92, 34, 10, 34);
- else
- putchar(*p);
- }
- printf("%c%c%c%c%s%c", 34, 59, 10, 10, str, 10);
- return 0;
- }
复制代码
我编译运行后用diff比较过,应该没问题,但有时复制粘贴以后格式上可能需要少许调整。 |
|