Most voted "operators" questions
Operators are symbols that occur in almost every programming language and coding, for performing calculations and comparisons on data. Use the tag only when operators are relevant to the problem, including questions about syntax, in any language.
Learn more…330 questions
Sort by count of
-
1
votes1
answer26
viewsAdd value to a reference value determined each different day for the whole year
How can I add a certain value to an existing value each day other than the year. Something like: $hoje = date('Y-m-d'); $amanha = date('Y-m-d', strtotime($hoje .' +1 day')); if ($hoje != $amanha) {…
-
1
votes1
answer83
views -
1
votes3
answers2609
viewsWhat is python’s " "?
I was seeing what it is, ta speaking "xor", but if I give 5 11 results in 14 and 5 5, 0? What exactly is this result?
-
1
votes0
answers57
viewsWhat is the use of bitwise shift operators?
Recently I discovered the bitwise shift operators << and >>. I know these operators move bits left and right, but what’s the use of doing this ? In which cases these shift operators are…
-
1
votes1
answer65
viewsFormat money value from database
I have an input with a mask where the user type the desired price and automatically is formatted. Before sending to the database, I transform this value so I can work with it with some arithmetic…
-
1
votes2
answers66
viewsobject1 += object2 is different object1= object1 + object2 in python(3.8)?
objeto1 += objeto2 and objeto1= objeto1 + objeto2 give different results even though the two forms seem equivalent. Could someone explain to me what I’m not realizing? class f(): def…
-
1
votes0
answers32
viewsNew python operator 3.8.5
Python 3.8.5 added operator :=, I wonder what it’s for
-
1
votes2
answers117
viewsWrite a program that reads a character and displays the boolean value True (true) if it is a digit between ' 0' and ' 9' if not False (false)
def cont(caracter): digito = ord(caracter) return digito == 0 or digito == 9 def main(): usuario = str(input()) print(cont(usuario)) if __name__ == '__main__': main() Where is the error in that…
-
1
votes1
answer103
viewsReturn true when Bigdecimal variable is different from null, otherwise return false
I have a type attribute BigDecimal x. I need to call a method exampleMethod(). I would like to pass the parameter true or false depending on whether x is null or not, as in the example below: val x:…
-
1
votes2
answers85
viewsHow can we not do anything if the suit falls into the fake?
I want you to get the selectedGenre is different from empty or null he perform movie.genre === selectedGenre, but if it is null or empty just exit the function without returning anything.…
-
1
votes2
answers71
viewsIs it possible to overload Javascript mathematical operators for objects?
I wanted to know how we can overload the subtraction operator, so that when the object is subtracted by another equal object, it returns a new object, with everything subtracted Example: var player…
-
0
votes1
answer397
viewsArduino - invalid operands of types 'double' and 'double' to Binary 'Operator'
#include <DHT.h> #include <math.h> #include <stdlib.h> #include <stdafx.h> #include <iostream> #define DHT1PIN 2 #define DHT2PIN 3 #define DHT3PIN 4 #define DHT4PIN 5…
-
0
votes1
answer130
viewsConverting split expression to C++ to C#
I have the following condition in C++ and would like to move to C#. The problem I’m having is with the function div error: The name 'div' does not exist in the Current context if (quant > 0) {…
-
0
votes3
answers146
viewsPerfect square, not so perfect
I need to know if the sum of two numbers is a perfect square, I thought of adding the two and take the root and then check if the rest of the division by 1 is greater than zero, only the operator…
-
0
votes1
answer106
viewsWhat is the operator << in the context of virtual memory paging?
I’m seeing the implementation of virtual memory and I have this code: #define INDEX_FROM_BIT(a) (a / 8*4) #define OFFSET_FROM_BIT(a)(a % (8*4)) static void set_frame(u32int frame_addr) { u32int…
-
0
votes1
answer81
viewsC++ problems with overloading Operator+ (Undefined Reference to 'Operator+(...))
I’m having trouble making the operator + overloading in C++. Does anyone have any idea what’s wrong? To perform Unit tests I am using googletest on Ubuntu. (wanted to do this to make the code…
-
0
votes2
answers277
viewsDisplay the first 5 divisional numbers by 3, discarding the number 0
I’m not able to display the first 5 divisibles by 3, I put a counter variable, but it returns another number. #include <stdio.h> #include <stdlib.h> int main() { int n = 20; for(int i=1;…
-
0
votes2
answers4700
viewsHow to find out if a number is odd or even?
How to find odd and odd pairs from this list? Sub kati() For li = 1 To 10 For col = 1 To 10
-
0
votes1
answer94
viewsHow to return a valid result from a PHP operation?
Hello. I want to return the result of an operation using two numbers and the operator as parameter. It turns out that my result is a string. <?php $n1 = $_POST['n1']; //primeiro número $n2 =…
-
0
votes1
answer380
viewsrequest for Member 'attributeOuDecisao' in Something not a Structure or Union
Tree initialization error, the problem with the category variables and atributoOuDecisao. typedef struct node { int categoria; int atributoOuDecisao; struct node *prox; struct node *lista; } No; No…
-
0
votes0
answers13
viewsDifference between If instruction and If operator
What are the differences between the if instruction and the if operator in VB.NET? If(Condicao, x(), y()) If Condicao Then x() Else y() End If…
-
0
votes1
answer67
viewsHow do Overload the assignment operator into a class that contains vector?
I would like to do the allocation operator’s Overload (operator=), I know I have to reserve memory, and copy data from one to the other, however I do not know how to copy one vector to the other…
-
0
votes1
answer34
viewsPicturebox.Image error <> My.resources.user_add
Hello, I am developing my TCC and there is an error that I can not solve... Below follows the code: If (imgAluno.Image <> My.Resources.user_add) Then That is, I want the program to enter in…
-
0
votes3
answers163
viewsOperator "!=" does not work in my code?
I have a part of my program that I do several checks when the button is clicked and one of these checks is: it picks the value inserted in textboxRankTecnica and has to buy with the array…
-
0
votes2
answers868
viewsC++ Visual Studio
Hello, I’m very beginner in Visual Studio.I installed recently and I’m trying programs in c++ starting with simple programs but a same program that ran perfectly in Geany appears with several errors…
-
0
votes2
answers648
viewsHow to add the values in a loop?
I want to add and show the total value of the consultation. In the case of 3 patients the sum would be 1350. But something is going wrong. case 2 : printf ("Particular:\n"); printf("O valor da…
-
0
votes2
answers920
viewsTurn string into operator
I have the following string '1+1', I have to transform the numbers into integers and perform the operation, have to transform the string '+' into the operator +, or other operators like '*' made a…
-
0
votes2
answers474
viewsPrint of the result of a ternary operator
How to display the output of a ternary operation next to a string, using Python? I intend to check if the size of the name typed is larger than "Braga". For this condition, I want to use the ternary…
-
0
votes1
answer83
viewsFunction NS_LOG - NS3(Network Simulator): What does the operator "<<" mean in practice?
I am working with the ns3 program, and trying to understand the code that I have at hand, I came across this line, and I would like to know what this sequence of "<" means. (I don’t mean the…
-
0
votes1
answer115
viewsWhat is this operator **?
What is this operator **, and what is it for? Every time I come across a piece of code in C++ with this operator. And if it is related to *, what’s the difference?
-
0
votes2
answers415
viewsProblem with ternary operator
I have a problem with the ternary operator. I want to use it to make the code more elegant because it is simple. But it’s as if it doesn’t work because it doesn’t update the variable. The following…
-
0
votes2
answers70
viewsConditional operator ?: not working
I’m having trouble using the ?: #include <stdio.h> int main() { int num1 = 10; int num2 = 20; int resposta; num1 < num2 ? printf("sim\n") : printf("nao\n"); // O erro acontece aqui ao…
-
0
votes1
answer316
viewsTernary conditional operator
I am trying to translate a condition of if and Else in ternary, however the conditions are composed, ie, need to indicate more than one instruction in the same line. According to what I researched…
operatorsasked 6 years, 7 months ago Drop Programador 1 -
0
votes1
answer161
views -
0
votes2
answers183
viewsValue Assignment Doubt in c
Here’s my code, why is there a change in the other variables, I’m not just changing the line line to variable value? why the others change? int a = 1, b = 2, c = 3, valor = 0; valor = a;…
-
0
votes1
answer95
viewsHow to do arithmetic operations using directly binary in C
I’m a beginner so there might be some wrong things here. I need to do thousands of calculations with data (decimal float numbers) from several giant csv files, so I figured using direct binary in…
-
0
votes1
answer635
viewsJavascript: Add object within an object array
I have: var options = { title: 'Titulo', width: largura, height: altura, vAxis: { title:"Porcentagem % em vendas", format: 'decimal' }, hAxis: { title: "Seleção de clientes - Comutativa", } }…
-
0
votes1
answer1146
viewsLaravel 5.7 (Blade) - Ternary operator on two levels is not working
The following code works: if($cc->is_removed){ $status = 'Removed'; } elseif (! $cc->isActive){ $status = 'Inactive'; } elseif ($cc->isActive){ $status = 'Active'; } and on the same page…
-
0
votes2
answers121
viewsArithmetic operations in PHP or Mysql?
What would be the good practice when doing arithmetic operations that come from a database query, for example: SELECT valor_bruto_atual, valor_investido, (valor_bruto_atual / valor_investido) AS…
-
0
votes1
answer22
viewsHow to subtract extreme indices from the same vector?
I am having difficulty in this exercise, I would like to know how it is possible to carry out this formula operation int main() { int A[20], i, soma, j; cout << "Digite o valor do vetor A";…
-
0
votes1
answer35
viewsWhat is the use of $ in an expression that executes a pipe in a property in Angular?
In the tutorial written by Jen Looper for Nativescript website it demonstrates a code that before the pipe is preceded by the symbol $ as below: <ScrollView> <StackLayout>…
-
0
votes1
answer95
viewsOperator ">" cannot be used comparing strings
import java.util.Scanner; public class ordenarNomes{ public static void main(String[] args) { Scanner in = new Scanner(System.in); String [] nomes = new String [20]; for(int…
-
0
votes1
answer38
viewsVariable is not found in an operator method
I’m studying operator overload but my code is not compiling. #include <iostream> using namespace std; class Complexo { public: int real, image; Complexo(); Complexo(int r, int i); Complexo…
-
0
votes1
answer67
viewsHow to make this simple operation return true?
I saw a post and was confused: 0.2 + 0.4 == 0.6 returned false. How to make this sum operation really equal to 0.6?
-
0
votes1
answer74
viewsCalling recursive function with decreasing operator
I wrote a code for solving a factor-adding problem. When I created the recursive function for the factorial calculation, I used in the function call the decrease operator -- followed by the number,…
-
0
votes2
answers151
viewsOperator ! in if ternary
Could someone explain to me the use of ! at the beginning of the code? $number = 28; $resultado = !($number % 2) ? "O número é par" : "O número é ímpar"; echo $resultado;…
-
0
votes1
answer28
viewsoperatorArhythmic
Good morning, does anyone know what that vertical bar in python means? 4|3 = 7 12|4 = 12…
-
0
votes1
answer195
viewsSentence while - not true... understanding logic
I’m having a lot of trouble understanding why the program stops when I type n=0. when type 0 the finished turns to True, and the while logic is just this, no? I’ve run the program and it’s correct,…
-
0
votes1
answer86
viewsMathematical and logical operators in Visualg
Why the codes highlighted in asterisk do not work the way I chose? I realized that using the smaller number first and the bigger number second, it works normally, but I’ve been itching to know why…
-
0
votes1
answer168
viewsWhat does the syntax " bool Operator < " mean in C++?
I looked for that reference (bool operator < and bool operator ==), I found some explanations, but I didn’t understand it very well. How this syntax works? Code: bool operator < (nome a, nome…