小程序 [英] Little program

查看:72
本文介绍了小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以看看这个小程序并告诉我为什么最后一行

没有编译。


#include< stdio.h>


int main(){

int i,j,k;

i = 0;

j = 9;

k = -8;

printf(给定i = 0,j = 9且k = -8 \ n);

printf(" Then for for \ if if(i),if(j)and if(k)\" \ n");

printf("答案是%d%d%d,如果(i),if(j),if(k)); / **解析
$'$ b'错误在''if''之前** /

返回0;

}


它可能是非常愚蠢的东西,或者我遗漏了一些东西,这更可能是
!但所有人都在努力学习C !!!!

提前致谢。

解决方案

mdh写道:


printf(" Then for \if(i),if(j)and if(k)\\ n" );



你不能拥有一个名为if的功能




jmcgill写道:


你不能有一个名为if的函数



我认为你可以(第56页,K& R II);


mdh写道:


jmcgill写道:


你不能有一个名为if的函数



我以为你可以(第56页,K& R II);



您对if语句的使用完全感到困惑。请仔细阅读

该页和前一页。


问候,

Bart。


Can someone look at this little program and tell me why the last line
is not compiling.

#include <stdio.h>

int main (){
int i, j, k;
i=0;
j=9;
k=-8;
printf("Given i=0, j=9 and k= -8 \n");
printf( "Then for \" if ( i) , if (j) and if (k)\"\n");
printf("the Answers are %d %d %d ", if(i), if(j), if(k) ); /**parse
error before ''if''**/
return 0;
}

It''s probably something really silly, or I am missing something, which
is more likely!! but all in the quest to learn C!!!!
Thanks in advance.

解决方案

mdh wrote:

printf( "Then for \" if ( i) , if (j) and if (k)\"\n");


You cannot have a function named "if"



jmcgill wrote:

You cannot have a function named "if"

I thought you could (page 56, K&R II);


mdh wrote:

jmcgill wrote:

You cannot have a function named "if"


I thought you could (page 56, K&R II);

You are thoroughly confused about the use of the if-statement. Re read
that page and the previous one very carefully.

Regards,
Bart.


这篇关于小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆