Questions tagged [addition]

Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign (+).

Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign (+).

It is commutative, meaning that order does not matter, and it is associative, meaning that when one adds more than two numbers, order in which addition is performed does not matter.

(Wikipedia)

5629 questions
26
votes
8 answers

How to subtract two strings?

I have a long string, which is basically a list like str="lamp, bag, mirror," (and other items) I was wondering if I can add or subtract some items, in other programming languages I can easily do: str=str-"bag," and get str="lamp, mirror," this…
max smith
  • 273
  • 1
  • 3
  • 4
25
votes
5 answers

Difference between add and addu

I am confused about the difference between add and addu. The MIPS instruction reference says: add (with overflow) add unsigned (no overflow) My understanding is to use add with signed operands and addu with unsigned operands. But let's consider…
collimarco
  • 34,231
  • 36
  • 108
  • 142
24
votes
6 answers

Are 'addition' and 'bitwise or' the same in this case?

Say I have four 32-bit numbers, defined so that their bits don't overlap, i.e. unsigned long int num0 = 0xFF000000; unsigned long int num1 = 0x00FF0000; unsigned long int num2 = 0x0000FF00; unsigned long int num3 = 0x000000FF; Where in each number…
Albus Dumbledore
  • 12,368
  • 23
  • 64
  • 105
24
votes
10 answers

Algorithm to add or subtract days from a date?

I'm trying to write a Date class in an attempt to learn C++. I'm trying to find an algorithm to add or subtract days to a date, where Day starts from 1 and Month starts from 1. It's proving to be very complex, and google doesn't turn up much, Does…
bcoughlan
  • 25,987
  • 18
  • 90
  • 141
24
votes
7 answers

How to add an object to an ArrayList in Java

I want to add an object to an ArrayList, but each time I add a new object to an ArrayList with 3 attributes: objt(name, address, contact), I get an error. import java.util.ArrayList; import java.util.Scanner; public class mainClass { public…
Johnfranklien
  • 525
  • 3
  • 5
  • 15
23
votes
1 answer

How do I replace embedded resources in a .NET assembly programmatically?

I am trying to replace a Resource of an exe (.NET, C#) file using C# code. I have found this article and made this code (using Mono.Cecil 0.6): AssemblyDefinition asdDefinition = AssemblyFactory.GetAssembly("C:\\File.exe"); EmbeddedResource erTemp =…
eranj
  • 367
  • 1
  • 3
  • 8
23
votes
7 answers

Code for adding to IEnumerable

I have an enumerator like this IEnumerable page; How can I add a page (eg: D:\newfile.txt) to it? I have tried Add, Append, Concat etc But nothing worked for me.
Sudha
  • 2,078
  • 6
  • 28
  • 53
23
votes
1 answer

Add Moving average plot to time series plot in R

I have a plot of time series in ggplot2 package and I have performed the Moving average and I would like to add the result of moving average to the plot of time series. Sample of Data-set (p31): ambtemp dt -1.14 2007-09-29…
A.Amidi
  • 2,502
  • 5
  • 25
  • 37
22
votes
7 answers

Addition is not working in JavaScript

I am trying to learn Javascript. Here I am confused with the following code. http://rendera.heroku.com/usercode/eae2b0f40cf503b36ee346f5c511b0e29fc82f9e When I put x+y in the function it is going wrong. For example 2+2=22, 5+7=57 But /, *, - are…
Theepan K.
  • 355
  • 3
  • 5
  • 11
22
votes
3 answers

How to add all items in a String array to a vector in Java?

My code looks like this : Vector My_Vector=new Vector(); String My_Array[]=new String[100]; for (int i=0;i<100;i++) My_Array[i]="Item_"+i; ...... My_Vector.addAll(My_Array); But I got an error message, what's the right way to do…
Frank
  • 30,590
  • 58
  • 161
  • 244
22
votes
5 answers

Is floating-point addition and multiplication associative?

I had a problem when I was adding three floating point values and comparing them to 1. cout << ((0.7 + 0.2 + 0.1)==1)<
Karen Tsirunyan
  • 1,938
  • 6
  • 19
  • 30
22
votes
3 answers

I am unable to add an element to a list? UnsupportedOperationException

This one list object is biting me in the butt.. Any time I try to add an element to it, it produces this: Caused by: java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:148) at…
Gray Adams
  • 3,927
  • 8
  • 32
  • 39
21
votes
5 answers

Android Add image to text (in text View)?

first post here=) I've been looking for this answer and haven't been able to find it. What I want to do is have some text, then add a image, then rest of text. For example: ____ | | Hi…
user1162299
  • 225
  • 1
  • 2
  • 8
21
votes
3 answers

Add characters to a numeric column in dataframe

I have a dataframe like this: V1 V2 V3 1 1 3423086 3423685 2 1 3467184 3467723 3 1 4115236 4115672 4 1 5202437 5203057 5 2 7132558 7133089 6 2 7448688 7449283 I want to change the V1 column and add chr before the number.…
Lisann
  • 5,705
  • 14
  • 41
  • 50
21
votes
3 answers

Add a new column to the file

How can I add a new column to a file using awk? original.file F1 F2 F3 ..F10 add F11 to original.file F1 F2 F3 ..F10 F11
user951487
  • 845
  • 7
  • 19
  • 30