读书人

一道牛公司C语言的面试题? 求解.该如

发布时间: 2012-04-28 11:49:53 作者: rapoo

一道牛公司C语言的面试题? 求解....
int main()
{
if()
{
printf("Hello ");
}
else
{
printf("World !!!");
}
return 0;
}
在if里面请写入语句 使得打印出 hello world。

[解决办法]

C/C++ code
#include <cstdio>#include <iostream>using namespace std;int main(){    if(!printf("Hello "))    {         printf("Hello ");    }    else    {        printf("World !!!");    }    return 0;}
[解决办法]
探讨

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
if(fork()!=0)
{
printf("Hello ");
}
else
{
printf("World");
}
return……

读书人网 >C语言

热点推荐