interesting... let me try 1&2...
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 3 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:hash (等级:7 - 出类拔萃,发帖:5077) 发表:2007-04-24 18:10:14  楼主  关注此帖评分:
programming puzzlesWrite a "Hello World" program in 'C' without using a semicolon. (this is tricky) C/C++ : Exchange two numbers without using a temporary variable. (somehow classic way) C/C++ : Find if the given number is a power of 2. (somehow classic way) Write a program whose printed output is an exact copy of the source. Needless to say, merely echoing the actual source file is not allowed. (a bit hard to think) source: http://developers.slashdot.org/article.pl?sid=04/12/04/0116231
interesting... let me try 1&2...
1.
#include <stdio.h>
void main() {
if (printf("hello world\n")) {}
}

2.
a=a+b;
b=a-b;
a=a-b;

欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:hash (等级:7 - 出类拔萃,发帖:5077) 发表:2007-04-25 11:36:18  2楼
what do you mean by classic way?C/C++ : Find if the given number is a power of 2. (somehow classic way) can i check bit by bit?
i was thinking of checking bit also.
no. 4 is tricky...
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:hash (等级:7 - 出类拔萃,发帖:5077) 发表:2007-04-29 04:42:22  3楼
my answer to (4)#include int main (void) { const char *str = "#include %cint main (void)%c{%c const char *str = %c%s%c;%c printf(str, 10, 10, 10, 34, str, 34, 10, 10, 10, 10);%c return 0;%c}%c"; printf(str, 10, 10, 10, 34, str, 34, 10, 10, 10, 10); return 0; }
(Y)
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 求学狮城 | 返回上一页 | 本主题共有 3 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码