"&放大器;&安培;"和"和"操作者用C

编程入门 行业动态 更新时间:2024-10-25 03:24:29
本文介绍了"&放大器;&安培;"和"和"操作者用C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图来计算两个整数的最大公约数。

I am trying to calculate the Greatest Common Denominator of two integers.

C code:

#include <stdio.h> int gcd(int x, int y); int main() { int m,n,temp; printf("Enter two integers: \n"); scanf("%d%d",&m,&n); printf("GCD of %d & %d is = %d",m,n,gcd(m,n)); return 0; } int gcd(int x, int y) { int i,j,temp1,temp2; for(i =1; i <= (x<y ? x:y); i++) { temp1 = x%i; temp2 = y%i; if(temp1 ==0 and temp2 == 0) j = i; } return j; }

在if语句,注意逻辑运算。这是和不是&放大器;&安培; (错误)。在code工作没有任何警告或错误。

In the if statement, note the logical operator. It is and not && (by mistake). The code works without any warning or error.

有一个和经营者使用C?我使用的 orwellDev-C ++ 5.4.2(在 C99 模式)。

Is there an and operator in C? I am using orwellDev-C++ 5.4.2 (in c99 mode).

推荐答案

点击这里,查看页面 iso646.h

这头定义了11个宏的是一些常见的运营商的对应文字。和是定义之一。

This header defines 11 macro's that are the text equivalents of some common operators. and is one of the defines.

请注意,我只能测试这一个C ++编译器,所以我不能肯定,如果你可以使用这个具有严格的C编译器。

Note that I can only test this for a C++ compiler so I'm not certain if you can use this with a strict C compiler.

修改我刚刚在这里 C编译器测试,它确实工作。

EDIT I've just tested it with a C compiler here and it does work.

更多推荐

&QUOT;&放大器;&安培;&QUOT;和&QUOT;和&QUOT;操作者用C

本文发布于:2023-05-25 10:53:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/226596.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:安培   操作者   放大器   QUOT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!