Click here to Skip to main content
15,917,455 members
Everything / Operator

Operator

operator

Great Reads

by Arctype SQL
How to use full text search and the match keyword to find a string in every table in a MySQL database
by Coral Kashri
Fold-expressions in extreme cases
by Shamim Uddin
Operator overloading in C#
by DiponRoy
Conditional filter query example in SQLAlchemy and Python

Latest Articles

by Coral Kashri
Fold-expressions in extreme cases
by DiponRoy
Conditional filter query example in SQLAlchemy and Python
by Arctype SQL
How to use full text search and the match keyword to find a string in every table in a MySQL database
by Shamim Uddin
Operator overloading in C#

All Articles

Sort by Score

Operator 

17 Oct 2019 by CPallini
(For our purposes) C# is a strong typed language, if max_rows is an int then you automatically obtain the result of floor division. Try int max_rows = 100 / 6; Console.WriteLine("{0}", max_rows);
16 Mar 2018 by OriginalGriff
It's because of the "&" in front of internal_organ_cream - remove them both and it will work: int internal_organ_cream = 5; int liquid_organs = 7; internal_organ_cream = liquid_organs; When you put "&" in front of a variable name, it returns the address of the variable, rather than it's content...
8 Mar 2019 by Richard MacCutchan
The definition of the operator
17 Oct 2019 by OriginalGriff
Try: Console.WriteLine(Math.Floor(100.0 / 16.0));
21 Nov 2020 by Richard MacCutchan
int a=3,b=3,c=3; a>b? a>c?printf("a"):a==c?printf("a c"):printf("c"): b>c?printf("b"):b==c?printf("b c"): b==a?printf("a b"):printf("b"); The equivalent code is: int a=3,b=3,c=3; if (a > b) { if (a > c) printf("a"); ...
13 May 2017 by Richard MacCutchan
int int_bits(unsigned x) { return count_bits(~0U); } That looks wrong, since it will return the same value for any value of x . I suggest changing it to: return count_bits(x);
13 May 2017 by Patrice T
Quote: C program to convert decimal to binary using bitwise and, shift operator The program do not convert, it just display the value in base 2. Note that internally, integers are stored in binary in C programs. To know what are & and ~, just read the documentation about 'bitwise operators'....
20 Oct 2017 by Member 12234330
Define a method which returns the sum of three rounded numbers. If the right most digit of the number is lessthan 5, then round off it's value to the previous multiple of 10 otherwise if the right most digit of the number is greater or equal to 5, then round off to the next multiple of 10. ...
20 Oct 2017 by OriginalGriff
Try using a function to round numbers: public static int Round(int x) { int leastDigit = x % 10; return (x - leastDigit) + (leastDigit
5 Dec 2017 by Optimistic76
Hi everybody, I have a question for you about overloading operator = for derived classes. Suppose for example to have two classes A, B defined like this: class A { protected: double v_; public: A(double initVal = 0.0) : v_(initVal) {} virtual ~A() {} double v() { ...
5 Dec 2017 by tra_la_la_la
Make the constructor B(A& src) explicit. Smth like explicit B(A& src)
5 Dec 2017 by Jochen Arndt
I have not checked your code and what it does because it is not implementing the assignment operators in the usual way. They should not return a copy but the object itself (note also that the operator in your class A is returning nothing). It should be: class A { // ... double v() const...
5 Dec 2017 by CPallini
I suggest you to have a look at this page: Copy constructors, assignment operators, - C++ Articles[^].
5 Dec 2017 by Optimistic76
if you are interested maybe i have found what i was searching for C++ Explained: Object initialization and assignment, lvalues and rvalues, copy and move semantics and the copy-and-swap idiom | Katy's Code[^]
17 Feb 2018 by phil.o
Well, 1 + 2 + 3 e2 is false. Moreover, A triangle is defined by 3 points; each point having two components, you cannot define a triangle with only three scalar values. You need three points, or 6 scalar values. I would add that the entire idea to compare two triangle is...
17 Feb 2018 by OriginalGriff
What defines two triangles as "bigger" and "smaller"? Is it the perimiter? The area? The location? About the only thing we know is that it's not "the sum of the three angles" becuase that is always the same value, given undistorted spacetime. The area of a triangle is 0.5 * b * h where b is...
16 Mar 2018 by BerthaDusStuf
I have written this code to test something for some code I am writing and it only works if I use == rather than =: #include using namespace std; int main () { int internal_organ_cream = 5; int liquid_organs = 7; &internal_organ_cream = &liquid_organs; } I tried running it like this...
16 Jan 2022 by kavinderrana121
I was reading Minimum spanning tree - Kruskal with Disjoint Set Union - Competitive Programming Algorithms[^] and I am confused in below operator overloading part used in above implementation,here how we can sort without defining the comparator. How is sorting taking Place over two...
8 Mar 2019 by CPallini
Richard already gave you the correct answer. As an addendum, looking at the documentation std::sort - cppreference.com[^], note the first overload of std::sort is used. Moreover, reading this article: "Sorting a vector of custom objects in C++"[^], could be helpful.
17 Oct 2019 by Zohaib Dhukka
max_rows = 100 // 16 print(max_rows) #answer 6 What I have tried: I need Floor division in c#, I have mentioned the Floor division in python but i need to do that in c#
21 Nov 2020 by Siddhant Arya
I encountered a question on a website where the output of the code was to be guessed: #include int main() { int a=3,b=3,c=3; a>b? a>c?printf("a"):a==c?printf("a c"):printf("c"): b>c?printf("b"):b==c?printf("b c"): ...
26 Nov 2020 by xhon
I'm on an MVC web application, it takes entities from a separate data Model layer. As I'm working on the entity Movie, the Views use the dataModelLayer.Movie model from the DataModelLayer. As the Index will show a list of movies, I created a new...
26 Nov 2020 by Richard Deeming
ListOfMovies listOfMovies = new ListOfMovies { Movies = movies }; Alternatively, fill in the implementation of your implicit operator: public static implicit operator ListOfMovies(List v) { return new ListOfMovies { Movies = v }; }
1 Apr 2021 by Arctype SQL
How to use full text search and the match keyword to find a string in every table in a MySQL database
16 Jan 2022 by Member 15502389
Hello, there is another method to sort vector of edges: struct Edge { int u, v, weight; }; bool comp(Edge e, Edge f) { return e.weight edges; sort(edges.begin(), edges.end(), comp); After you define struct,...
18 Oct 2022 by Maciej Los
I'd suggest to read this excellent tip: Using comma separated value parameter strings in SQL IN clauses[^]
17 Mar 2023 by Phoenix Liveon
How do we properly create an overloaded operator specifically this "
17 Mar 2023 by klarrra
Find some good help here. https://kbrown.hashnode.dev/c-in-computer-science
22 May 2023 by Coral Kashri
Fold-expressions in extreme cases
2 Oct 2016 by Shamim Uddin
Operator overloading in C#
21 Nov 2020 by Rick York
The format of the ternary operator is condition ? true_statement : false_statement; which means when condition is true the true_statement is executed and when it is false the false_statement is executed. It will probably help to rewrite the...
21 Nov 2020 by Patrice T
Quote: By checking each individual condition of the ternary I was unable to point out the output The code is specially crafted to make its structure difficult or impossible to figure out. You need to rewrite and reformat the code. The rewriting...
3 Jul 2022 by DiponRoy
Conditional filter query example in SQLAlchemy and Python
13 May 2017 by Member 13188016
this code is an example from a book that the problem require to change decimal to binary number using bitwise AND oeprator and shift operator. i cannot understand the code although had tried to understand this code using debug compiler. suppose for a and b, user input is 10 and 8 #include...
16 Jan 2022 by Member 15502389
And that's already working code for Kruskal algorithm for finding MST (obviously using Disjoint Set Union) struct Edge { int u, v, weight; }; bool comp(Edge e, Edge f) { return e.weight edges; int n, m,...
17 Feb 2018 by Suren97
I have Triangle Class, i need to compare two triangle with each other,i tried but it have given me error.What's my mistake? What I have tried: class Triangle { public int koxm1; public int koxm2; public int koxm3; public Triangle(int a, int b, int c) ...
22 Oct 2022 by Member 12254178
SELECT * FROM [M_Details] where Dcat IN (@Cats) if I give like this in dataset table adapter in vb.net 2010, multiple input values are not filtering. Suppose I pass one argument and then it's working. But if I pass by an argument with more than...
22 Oct 2022 by Member 12254178
I found this solution for multiple word search to a same column in code. Paste this code as Function. and call in to textbox control for required inputs. Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)...