26 Topics

Member Avatar for
Member Avatar for vegaseat

Just some interesting applications of the bitwise and (&), or (|) operators. You might find some other uses.

Member Avatar for vegaseat
0
277
Member Avatar for Gà_1

**Problems 1: Spiral matrix - Advanced** Source of the problem: [Here (not in English)](http://www.spoj.com/PTIT/problems/BCACM11B/) Spiral matrix is formed by filling number 1 in 1st row 1st column, after that, filling with increasing number by clockwise, example: 1 2 3 4 5 16 17 18 19 6 15 24 25 20 …

Member Avatar for tien.nguyen.3532507
0
366
Member Avatar for DS9596

Can someone check if I am doing these right please, thanks ? int a=3, b=5, x; x= a/b + b/a +a%b + b%a; cout << x; // x=0+1+0+1= 2 y=float(b/a)+ float(b)/a; cout << y; // y=1.6+1=2.6 z=a*b/2; cout << z; // z= 4 w=pow(b, a)+sqrt(a+b); cout << w; // w=125+2sqrt(2) …

Member Avatar for YarMak
0
247
Member Avatar for Learner010

# Tutorial On Operators# *Operators are the signs to the tell the compiler to perform specific task*. The Operators fall into following categories :- Arithmatic Operator Relational Operator Logical Operator Bitwise Operator Miscellaneous Operator(i added Assignment Operators in this categeory) **Arithmatic operators:-** There are following arithmetic operators:- + Add [6+2=8] …

Member Avatar for Learner010
5
683
Member Avatar for sparky58

This assignment asks to add some code from to a previous assignment I had. I have been confused about this overload operators alot and im confused on how to do it in my code any help with this will be good A) overload the >> operator to allow for reading …

Member Avatar for Banfa
0
386
Member Avatar for mattster

Hi folks, I am aware this is a problem that many people have, but I am yet to find an answer... I have a 10x10 grid generated using a html `<table>`, each cell has an id reffering to its location (ie. #15 - row 1, colmn 5). All I need …

Member Avatar for LastMitch
0
359
Member Avatar for saurabh.mehta.33234

I came across the foll code: #include<stdio.h> main() { int i=4,j=7; j=j||(printf("you can")&&(i=5)); printf("%d %d",i,j); } output: 4 1 Athough I am specifying the braces for the && operator so that it gets executed first..Then also the value of i remains 4 only..Why doesnot it gets changed to 5??Also the …

Member Avatar for Banfa
-1
229
Member Avatar for arupface

The comparison operators: * === * <=> * eql? * equal? * == Both are performing equality check I know. Some of them overrides `==` also. But now my query is how to think,what to use in what situations? Explanation with a code would be better idea to understand. Thanks …

Member Avatar for Taywin
0
204
Member Avatar for Eyeteeorg

As someone who is new to Javascript, I find it kind of odd that Javascript doesn't seem to have a != operator. Is there a rationale why the language was designed this way?

Member Avatar for Eyeteeorg
0
192
Member Avatar for LastMitch

Hi I'm been trying to enter numbers into the <input> so I can calculate **Add** - **Subtract** - **Divide** - **Multiply**. This is the equations: <?php $number = 20; $number += 10; print "\$number += 10;<br /> The answer is <b>$number</b>. <br /><br />"; $number -= 12; print "\$number -= …

Member Avatar for LastMitch
0
257
Member Avatar for anglwthnati2de

Hi guys. I am having issues with the output of this program. Can somebody tell me what I have to do to make this work correctly? Here is the code I have so far: import java.util.Scanner; //text scanner to parse primitive types and strings using regular expressions. public class Operations …

Member Avatar for anglwthnati2de
-2
272
Member Avatar for rahul.ch

Why does first two eg give true when a check done on them using if(x==y) but 3rd and 4th case give false? eg1: `String x = "Hello", y="Hello" ` eg2: `String x = "Hello";` `String y= "Hello";` eg3: `String x="Hello";` `String y = new String("Hello");` eg4: `String x = new …

Member Avatar for rahul.ch
0
239
Member Avatar for rahul.ch

The o/p is 10. But shouldn't it be 9? Is it got anything to do with Postfix or variable scoping has a role to play?

Member Avatar for rahul.ch
0
169
Member Avatar for Rubinder singh

I need a code which can solve the equations like this :- 56*78+(78/8) In this we know that brackets must be solved first and then divide/multiply and then add/subtract. So, i need a code for solving this kind of equations which contains multiple operators in single line. Thnks :)

Member Avatar for Rouf mir
0
286
Member Avatar for FelineHazard

Hi all, I have a rather basic C/C++ question about the priority of the ++ operator in regard to pointers. Note the following code (joining two strings): #define LENGTH 255 void mystrcat (char *base, char *add) { while(*base) ++base; while( *(base++) = *(add++) ); } int main() { char name[LENGTH]="Feline"; …

Member Avatar for rubberman
0
660
Member Avatar for Esmerelda
Member Avatar for reynaud0000

Hi guys i need a little help fast i have a calculator and its giving me some problems This calculator reads from a text file the result shows in the terminal but its giving me some troubles For one only the + operator works I cant use the overflow function …

0
134
Member Avatar for NickPatton

My assignment is to write a program that outputs the following columns of numbers using mathematical operators and the loop index. This is what I want the program to output: [CODE]1 10 0 1 1 0 2 20 1 4 2 0 3 30 2 9 3 0 4 40 …

Member Avatar for NickPatton
0
232
Member Avatar for tvm78

So I'm trying to write a program that is due tomorrow. I am trying to overload operators and dealing with template classes. I have everything written already but keep getting this error whenever i try to compile the driver file: NOTE: proj4.cpp has #include "box.h" and box.h compiles fine, but …

Member Avatar for NathanOliver
0
270
Member Avatar for ThuggyWuggy

I attempted to overload the == operator for one of my classes, I even copied a previous implementation of it, but now that I am using pointers it refuses to function properly here is the relevant code (there is a lot so I will provide more if need be) [CODE]#ifndef …

Member Avatar for ThuggyWuggy
0
6K
Member Avatar for mike_2000_17

Hey, I have a set of types which are all arithmetic (have operators for addition, subtraction, multiplication, etc.). I want to aggregate any number of them into a single object, so I'm using the std::tuple class template and the <tuple> library (and Boost.Tuple for backward compatibility). My question is a …

Member Avatar for mike_2000_17
0
508
Member Avatar for cadence441

For some people it may be difficult to understand what Boolean is.Well, it's a type of algebra. We will be learning about three Boolean operators today-AND,OR,NOT The order for evaluating Boolean operators are as follows:- AND-If you have a code that should be executed if two conditions are true, you …

Member Avatar for mike_2000_17
0
171
Member Avatar for stkarnivor
Member Avatar for mike_2000_17
0
573
Member Avatar for n0de

Hi, i have some issues with class inheritance and i do not know how to solve it, maybe someone could help me with that ? [CODE] //pentathlete.h #include <iostream> using namespace std; template < class T > class pentathlete { protected : T comp_res [ 5 ] ; /*private: int …

Member Avatar for n0de
0
156
Member Avatar for Labdabeta

Is it possible to overload an operator for a built-in type? And if so what is it's syntax? EG: [CODE]//Use of overloaded operator^ for types double and double (assuming it is overloaded for exponent): double a=10.0; double b=2.5; double pow=a^b;//pow is approximately 316.22....[/CODE]

Member Avatar for L7Sqr
0
174
Member Avatar for Labdabeta

I am working on making a 'safetype' abstract class, which will have a complete set of pure virtual operator overloads to help make sure that a class inherited from it is safe to pass to virtual any function. The problem is that I don't know the syntax of a pure …

Member Avatar for Labdabeta
0
239

The End.