标签: operator-keyword

什么呀!运算符的意思是如果放在变量前面?

我有一个简单的问题,我正在学习C编程,我知道!运算符表示逻辑非。我的问题是,在这种情况下,以“做而做”循环为条件是什么意思?是否以某种方式检查变量是否已更改?

我知道我应该以某种方式找到它,但是当我尝试使用Google'!'时,它并不想显示我的意思。

#include <stdio.h>

int main() {
    int input, ok=0;
    do {
        scanf("%d", &input);
        if ( /* condition */) {
            //the input is wrong it will scan another one
        }
        else {
            //the input is correct, so the while cycle can stop
            //we don't need more inputs
            ok = 1;
        }
    } while (!ok);

    //...
    //...
    //...

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c operator-keyword

-5
推荐指数
1
解决办法
87
查看次数

运算符'=='不能应用于'int'和'string类型的操作数

我正在写一个程序,我想到一个数字,计算机猜测它.我正在尝试测试它,但我一直都会遇到错误.错误是主题标题.我使用Int.Parse转换我的字符串,但我不知道为什么我收到错误.我知道它说'=='不能和整数一起使用,但是我在网上看到的所有东西以及我班上的幻灯片都使用它,所以我卡住了.代码是不完整的,我不想让它运行,我只是想解决问题.非常感谢任何帮助,谢谢:D

class Program
{
    static void Main(string[] args)
    {
        Console.Write("Enter any number after 5 to start: ");
        int answer = int.Parse(Console.ReadLine());
        {
            Console.WriteLine("is it 3?");
            if (answer == "higher")
Run Code Online (Sandbox Code Playgroud)

c# string int operator-keyword

-6
推荐指数
1
解决办法
1万
查看次数

C++中是否有SIGN运算符?

他们是操作员'+'和' - '来操纵他们操作数的标志吗?

我现在知道我的意思是一元加减运算符!

我以前从未见过这个操作员.

它们是否已在C++ 11或更高版本的C++标准中引入?

c++ sign operator-keyword

-6
推荐指数
1
解决办法
80
查看次数

C#operator?:如何简化一个表达式中的基本if语句

有没有办法简化这个表达式:

我想做这个:

d = ( a == "x" ? b : a ) 
Run Code Online (Sandbox Code Playgroud)

我可以使用三行代码:

d = a;
if(a == "x")
   d = b
Run Code Online (Sandbox Code Playgroud)

我能做到这一点的代码/一个表达的一条线,而无需使用两次?

c# expression operator-keyword

-7
推荐指数
1
解决办法
182
查看次数

在这个例子中"&"做了什么?

正如标题所说,&在这个例子中做了什么:

#include <iostream>

using namespace std;

int main()
{
    int a = 10;
    int b = 13;
    int c = a & b;

    cout << c << endl;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我的问题是"&"对a&b做了什么,为什么c结果为8?

我目前正在学习本教程,但没有解释"&"运算符.

c++ int operator-keyword

-7
推荐指数
1
解决办法
96
查看次数

java - 哪个优先级更高,+ 或 -

考虑这个表达式:

x1 = ++x - x++ + --x
Run Code Online (Sandbox Code Playgroud)

如果输入 x 的值 5

java中这种表达式的输出是什么,为什么?

java operator-precedence operator-keyword

-21
推荐指数
1
解决办法
242
查看次数

前后增量中的java vs C++

为什么Java输出50时C++输出51相同的代码概念?

int i=5;

i= (++i + ++i + ++i + ++i + ++i + i++);

print i
Run Code Online (Sandbox Code Playgroud)

Java的: 50

C++: 51

c++ java increment operator-keyword

-23
推荐指数
1
解决办法
453
查看次数

标签 统计

operator-keyword ×7

c++ ×3

c# ×2

int ×2

java ×2

c ×1

expression ×1

increment ×1

operator-precedence ×1

sign ×1

string ×1