?输出 [英] ?output

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

问题描述

它的输出是什么以及为什么?

#include< iostream>


使用命名空间std;

#define abs (x)(x> 0?x:-x)

void main()

{

int a = 3,b = 5 ;

cout<< abs(abs(a + b));

}

解决方案
" JW" < JA ***** @ gmail.com>在留言中写道

news:11 ********************** @ g14g2000cwa.googlegr oups.com ...

:它的输出是什么?为什么?

:#include< iostream>



:使用命名空间std;





:#define abs(x)(x> 0?x:-x)

: void main()

:{

:int a = 3,b = 5;

:cout<< abs(abs(a) + b));

:}


我们不做作业。

尝试替换宏,看看会发生什么。


-
http://ivan.vecerina.com/contact/?subject=NG_POST < - 电子邮件联系表格


jw写道:

#include< iostream>
使用命名空间std;

#define abs(x)(x> 0?x:-x )
void main()
{a / 3,b = 5;
cout<< abs(abs(a + b));
}



这个程序格式不正确,不应该在第一个

的地方编译。如果它在没有诊断的情况下进行编译,你的编译器就会坏掉,因此它的输出不是可靠的信息来源。

-

< mailto :二*********** @ yahoo.com> < http://www.dietmar-kuehl.de/>

< http://www.eai-systems.com> - 高效的人工智能


jw写道:

它的输出是什么?为什么?
#include< iostream>

使用命名空间std;

#define abs(x)(x> 0?x:-x)
void main()
{
int a = 3,b = 5;
cout<< abs(abs(a + b));
}




你是什么认为输出是什么?为什么?


阅读常见问题5.2。


what is its output and why?
#include<iostream>

using namespace std;
#define abs(x) (x>0 ? x:-x)
void main()
{
int a=3,b=5;
cout<<abs(abs(a+b));
}

解决方案

"jw" <ja*****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
: what is its output and why?
: #include<iostream>
:
: using namespace std;
:
:
: #define abs(x) (x>0 ? x:-x)
: void main()
: {
: int a=3,b=5;
: cout<<abs(abs(a+b));
: }

We don''t do homework.
Try substituting the macros, and see what happens.

--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form


jw wrote:

#include<iostream>

using namespace std;
#define abs(x) (x>0 ? x:-x)
void main()
{
int a=3,b=5;
cout<<abs(abs(a+b));
}



This program is not well-formed and should not compile in the first
place. If it compiles without diagnostic your compiler is broken and
thus its output is not a reliable source of information.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence


jw wrote:

what is its output and why?
#include<iostream>

using namespace std;
#define abs(x) (x>0 ? x:-x)
void main()
{
int a=3,b=5;
cout<<abs(abs(a+b));
}



What do you think the output is and why?

Read the FAQ 5.2.


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

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