主要功能中的宏。 [英] Macro in main function.

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

问题描述

写一个宏,其中交换两个数字而不使用第三个变量然后在主函数中调用

宏。


提示:a = 4,b交换a = 2后,= = 2,b = 4.

Write a macros in which swap two number without using 3rd variable and then call
Macro in main function.

Hint: a=4, b=2 after swapping a=2, b=4.

推荐答案

是的,该怎么办是明确的。


什么是你的问题?
Yes, what to do is clear.

What is your question?


把它移到C / C ++论坛
Moving this to C/C++ forum



写一个宏,其中交换两个数字而不使用第三个变量,然后在主函数中调用

宏。


提示:交换a = 2后a = 4,b = 2, b = 4。
Write a macros in which swap two number without using 3rd variable and then call
Macro in main function.

Hint: a=4, b=2 after swapping a=2, b=4.



以下是一些提示:


1.使变量a值为a + b


2.使变量b的值为ab。


只剩下一个交换值的步骤,但我会留给你。

由你来决定最后一步,我觉得这很公平。


Savage

Here are some hints:

1.Make variable a to have value of a+b

2.Make variable b to have a value of a-b.

There is only one more step left to swap values,but I will leave it to u.
It''s up to u to figure out last step,I think that''s fair.

Savage


这篇关于主要功能中的宏。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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