返回信息流☆─────────────────────────────────────☆
sunway (sunway) 于 (Thu Dec 4 10:22:33 2008) 提到:
☆─────────────────────────────────────☆
guo (计忆邮心|郭) 于 (Thu Dec 4 10:24:58 2008) 提到:
见过这样一道题
写一个精炼,可编译的代码实现在控制台下打印字符"A",你能做到源码字数少于12吗?你是怎么做到的?
☆─────────────────────────────────────☆
sunway (sunway) 于 (Thu Dec 4 10:26:54 2008) 提到:
我想了一个,不知道算不算:
1.c:
A
gcc 1.c -DA='int main() {puts("A");}'
...
【 在 guo (计忆邮心|郭) 的大作中提到: 】
: 见过这样一道题
: 写一个精炼,可编译的代码实现在控制台下打印字符"A",你能做到源码字数少于12吗?你是怎么做到的?
☆─────────────────────────────────────☆
guo (计忆邮心|郭) 于 (Thu Dec 4 10:30:16 2008) 提到:
挺短的 呵呵
不知道能再短不
☆─────────────────────────────────────☆
guo (计忆邮心|郭) 于 (Thu Dec 4 10:34:30 2008) 提到:
直接main(){puts("A");}不加返回值
-DA就不算了吧...
☆─────────────────────────────────────☆
sunmoonstar (摔锅啦) 于 (Thu Dec 4 10:34:59 2008) 提到:
可以把int 拿掉吗
☆─────────────────────────────────────☆
IcyPenguin (冰企鹅|【路过团】前将军) 于 (Thu Dec 4 12:25:39 2008) 提到:
真是精益求精啊
☆─────────────────────────────────────☆
haifan (帆) 于 (Thu Dec 4 15:12:11 2008) 提到:
A
☆─────────────────────────────────────☆
wks (cloverprince) 于 (Thu Dec 4 15:56:10 2008) 提到:
main.c:(一共11个字符)
#include<a>
a:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<arpa/inet.h>
#include<select.h>
#include<poll.h>
char* usage = "USAGE: a\n"
"This program prints 'A' to the console. It is designed to be the shortest program \n"
"that does this kind of silly but useful job. It also demonstrated the overwhelming \n"
"power of the C language.";
int showError(void) {
puts(usage);
}
int main(int argc, char* argv[]) {
if(argc>0) {
int i;
for(i=0;i<argc;i++) {
if(i==0) {
if(strcmp(argv[i],"a")!=0) {
printf("hey, stupid! You should have compiled your program into a file named 'a'. If you see this message, you probably are running Micro$oft Windows operating system. Try a better one, guy!\n");
} else {
}
}
if(strlen(argv[i])>0) {
printUsage();
exit(1);
}
}
}
int accepted=0;
do {
fprintf(stderr, /* This does not output to stdout! */
"By executing this program, you accept the TERM TO USE of this software.
This software is a proprietary property of ooxx, from www.ooxx.com.cn.
You may use this software for any purpose, only restricted by the law. You may
not try to discover the source code, do reverse engineering on the binary executable,
distribute this software with money exchange or modify it in any form. In order to continue, you must type 'I Agree':\n");
char* buf[2323];
scanf("%s", buf);
if(strcmp(buf,"I Agree")==0) { break; }
else fprintf(stderr,"Please input I Agree\n");
} while (1);
int sid;
sid = socket(AF_INET,SOCK_STREAM,0);
fprintf(stderr, "sending registration information to my website...\n");
fprintf(stderr, "please wait patiently for reply...\n");
register(sid);
fprintf(stderr, "ok");
printf("A");
return 0;
}
void register(int socket_id) {
/* not implemented */
}
☆─────────────────────────────────────☆
guo (计忆邮心|郭) 于 (Thu Dec 4 15:59:24 2008) 提到:
有才
【 在 wks 的大作中提到: 】
: main.c:(一共11个字符)
: #include<a>
: a:
: ...................
☆─────────────────────────────────────☆
tsunami (风之子) 于 (Sat Dec 6 00:52:38 2008) 提到:
弱弱的问,这个怎么运行呢?
【 在 guo 的大作中提到: 】
: 有才
☆─────────────────────────────────────☆
HectorInsanE (EJ|BYR-Enjoy|GC|TIC029|鲨鱼帮极光鲨) 于 (Sat Dec 6 10:49:32 2008) 提到:
【 在 wks 的大作中提到: 】
: main.c:(一共11个字符)
: #include<a>
: a:
: ...................
还顺带BS了MS……
☆─────────────────────────────────────☆
yegle (一阁@SL小分队@lp是大牛) 于 (Sat Dec 6 10:52:11 2008) 提到:
cow…仔细通读了一遍…
【 在 wks (cloverprince) 的大作中提到: 】
: main.c:(一共11个字符)
: #include<a>
: a:
: ...................
☆─────────────────────────────────────☆
lanphon (从此低调) 于 (Sat Dec 6 11:02:25 2008) 提到:
读不懂的飘
【 在 yegle (一阁@SL小分队@lp是大牛) 的大作中提到: 】
: cow…仔细通读了一遍…
☆─────────────────────────────────────☆
Shannonbyr (Shannonbyr) 于 (Sat Dec 6 11:09:07 2008) 提到:
同不懂,能解释下怎么样运行吗?
【 在 yegle 的大作中提到: 】
: cow…仔细通读了一遍…
☆─────────────────────────────────────☆
yegle (一阁@SL小分队@lp是大牛) 于 (Sat Dec 6 11:10:36 2008) 提到:
printf("hey, stupid! You should have compiled your program into
a file named 'a'. If you see this message, you probably are running Micro$oft
Windows operating system. Try a better one, guy!\n");
【 在 Shannonbyr (Shannonbyr) 的大作中提到: 】
: 同不懂,能解释下怎么样运行吗?
☆─────────────────────────────────────☆
lanphon (从此低调) 于 (Sat Dec 6 21:24:59 2008) 提到:
你少了好几个\
【 在 yegle (一阁@SL小分队@lp是大牛) 的大作中提到: 】
: printf("hey, stupid! You should have compiled your program into
: a file named 'a'. If you see this message, you probably are running Micro$oft
: Windows operating system. Try a better one, guy!\n");
: ...................
这是一条镜像帖。来源:北邮人论坛 / cpp / #26077同步于 2009/7/10
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
[合集] 能输出A的最短的C/C++程序是啥?
shenlei
2009/7/10镜像同步0 回复
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。