Cell C4 has the expression =565+660+709+1093 Is there a function/nest of functions that can output the number of values being added? BIG NOTE: I AM NOT ASKING FOR THE SUM OF THE EXPRESSION! |
+0 forum
1 | ||

Im trying to add odd numbers recursively from n to m but its not working . im sure its in the recursive logic on how im passing the arguments or something. public static int OddSum(int low, int up,int total) { if(low==up) { return up; }else { low+=2; return total += OddSum(low,up,total+low); } |
+0 forum
6 | ||

#include <iostream> #include <cstdlib> using namespace std; // function prototype for add int add (int x, int y); int sub (int q, int r); int mul (int s, int t); int divi (int u, int v); int main () { int a,b; char ch; loop:cout<<"ENTER CHOICE OF OPERATION: + - OR * / and q to quit"; cout<<'\n'; cin>>ch; int result; if(ch!='+'&&ch!='-'&&ch!='*'&&ch!='/'&&ch!='q') { cout<<"wrong input"; } else { if(ch=='+') { result = add( a, b ); } else if(ch=='-') { result=sub(a,b); } else if(ch=='*') { result=mul(a,b); } else if(ch=='/') { result=divi(a,b); } else if(ch=='q') { exit(0); } cout<<"enter 1st number"; … |
+0 forum
2 | ||

Program Design |
+0 forum
1 | ||

I want to make two polynomials and then add them. We have two lists, [1,2,0,3] and [2,3,0,0,1]. The polynomials are as followed: 3x^3+2x+1 and x^4+3x+2. I have the following code, but I'm getting stuck. Any advice? I'm new to python. def polyAdd(poly1,poly2): for i in range(len(poly1)): z = poly1[i] return z for j in range(len(poly2)): y = poly2[j] return y if i == j: coef = y + z print(coef) |
+0 forum
1 | ||

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 is a snippet that will take the cell id, and add one -> #15 becomes #16, rather than #151... I can use normal Javascipt or jQuery, whichever is easiest :) Thanks in advance! |
+0 forum
4 | ||

Hi I want to take input of two variable as integer and than do addition with the two variables. The ans will stored in another variable. The program will repeat after every addition end and will ask for user input of varibles and will do addition again. My qus is taht how can i add all aditions ans again: Exm: Input a= 5 Input b=5 ans=10 Agin program will ask for Input a= 6 Input b= 6 ans=12 now how can i take all " ans " value with program and do additions of all "ans" Final Ans=10+12=22 my code: … |
+0 forum
3 | ||

public class secenek { public static void main(String[] args) { int option=0; int a,b; a=5; b=7; if (option==0){ System.out.println("A+B= "+a+b); } } } |
+0 forum
1 | ||

I am trying to create a function which adds an array to another array and replaces the data in the 1st array with the new data. For example, A=A+B. However, when I write my code as below, I get the error C2676:binary '[' : 'const Matrix' does not define this operator or a conversion to a type acceptable to the predefined operator. void Matrix::add(const Matrix&m){ for(int i=0; i<9; i++){ data[i]=data[i]+m[i]; } } Thanks in advanced for the help! |
+0 forum
2 | ||

i was searching for a code to perform binary XOR addition. Exams coming up, and needed to a quick way to create and verify standard array tables. However, i didnt find anything substantial on the internet, so made my own version of it. can anyone take a look and tell me if there's some other(better) way to do this? thanks in advance for your time :) somjit. here's the code: #include<stdio.h> #include<string.h> int main(){ int *stop,decNum1=0,decNum2=0,result=0,ip_base=2,flag=0,i=0,binLength=0,temp=0,opResult[15]; char num1[15],num2[15]; puts("\n"); do{ printf("enter two binary numbers of same length(<15):\n"); printf(" enter 1st binary number: "); fgets(num1,15,stdin); binLength=strlen(num1); decNum1=strtol(num1,&stop,ip_base);// decNum1 is the dec … |
+0 forum
0 | ||

Please Help me with this Date Operation Program. I think that this works....yet! Thanks #include <iostream.h> #include <conio.h> int a[7]={1,3,5,7,8,10,12}; int b[7]={4,6,9,11}; class manipdate { int date; int month; int year; public: int d,m,y; void getdata() { cout<<"\n\n Date : "; cin>>date; cout<<"\n Month : "; cin>>month; cout<<"\n Year : "; cin>>year; } void display(int d, int m, int y) { cout<<" "<<d<<" / "<<m<<" / "<<y; } manipdate sub(manipdate q) { if(q.d < 0) { q.d = -q.d; if(q.d>30) { for(int i=0;i<7;i++) { if(q.m==a[i]) { if(q.d>31) { q.d -= 31; q.m--; } } else if(q.m==b[i]) { q.d -= 30; … |
+0 forum
5 | ||

pls help.. I have a to create a timecard calculator. it goes this way txtbox1 is for their 1st in txtbox2 is for their 1st out textbox3 is for the difference of txtbox1 and textbox2 txtbox4 is for their 2st in txtbox5 is for their 2st out textbox6 is for the difference of txtbox4 and textbox5 textbox7 is for the sum of total hour and minutes of textbox3 and textbox6 |
+0 forum
5 | ||

Let me start off by saying that this is homework, and I have most of it completed. However, I am stuck on how to convert decimal to hexadecimal. The assignment is to add two hexadecimal numbers and output the answer. If the length of the answer is greater than 10 digits, then output "Addition Overflow." I've completed the conversion of the two strings to decimal and added them together, now I think that I need to convert the answer back to a string. I know it's long, but if you would take the time to read my code, then it … |
+0 forum
42 | ||

Hey, I have to build an addition calculator. in the application interface should have a label on top which displays the number you clicked then under the label a running total label and then under than there should be a keypad with numbers from 0-9 and a plus sign. my plus sign should react as an equal button. so if i click 3 then + and then click 4...to see 7 i must click the plus button again. so to add a number o the sum the addition button must be clicked heres what i have so far but i … |
+0 forum
2 | ||

I'm writing a program to add two hex numbers of up to ten digits, and I'm recieving an "assertion failure," and I can't figure out why. Any help would be greatly appreciated. Thank you for you time! [CODE] // hex addition.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <string> #include <cmath> using namespace std; void convertToDec(string, string); int _tmain(int argc, _TCHAR* argv[]) { //assign values to last six hex characters //convert both inputs to dec //add two dec numbers //convert back go hex for answer string input; string input2; string hex[16] = … |
+0 forum
7 | ||

I'm writing a program that adds two hexadecimal numbers of up to ten digits. I'm trying to use the POW function, but for some reason it's underlined. Why is that? [CODE] // hex addition.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <string> #include <cmath> using namespace std; void convertToDec(string, string); int _tmain(int argc, _TCHAR* argv[]) { //assign values to last six hex characters //convert both inputs to dec //add two dec numbers //convert back go hex for answer string input; string input2; string hex[16] = {"0", "1", "2", "3", "4", "5", "6", … |
+0 forum
2 | ||

Hi, I have javascript which counts seperately every time 2 seperate buttons are clicked, this then outputs the amount on the same page. This works, however I am now trying to add a third value to output on the page which is the total of the clicks which i would calculate by adding the 2 attributes together. This just doesn't seem to be working though. java [CODE]<script type="text/javascript"> var NextClick = 0; var PrevClick = 0; var TotalClicks = 0; function getValueNext() Â Â { var y=document.getElementById("NextClick").value = ++NextClick $('.NextClick').val(y); Â Â } function getValuePrev() Â Â { var x=document.getElementById("PrevClick").value = ++PrevClick $('.PrevClick').val(x); Â Â } function getSumClicks() … |
+0 forum
1 | ||

I'm trying to make a price calculator for my friend's car shipping company. It seemed like a simple thing to do but with my skills I'm having some problems. The calculator takes the distance from zipcode 1 to zipcode 2, and mutplies the total miles by .32 to get the base price. No problems here. Then I need to see if both zip codes are part of a large metro area, if not there's a 30% increase in price. I got this working properly too. The next step is to get the customer car type and additional costs depending on … |
+0 forum
2 | ||

#include<iostream> using namespace std; class polynomial { private: struct p { int degree; float coefficient; p *link; }*head; public: polynomial() { head=NULL; } void getdegree(); void getpolynomial(int d); void display(); void addition(polynomial p1,polynomial p2); }; void polynomial::getdegree() { int degree1; cout<<"\n Enter the highest degree of your polynomial:"; cin>>degree1; getpolynomial(degree1); } void polynomial::getpolynomial(int degree1) { int i=0; p *temp,*data; float *arr; arr=new float[degree1+1]; for(i=degree1;i>=0;i--) { if(i==0) { cout<<"\n Enter the constant term:"; cin>>arr[i]; } else { cout<<"\n Enter the coefficient for degree x^"<<i<<":"; cin>>arr[i]; } } for(i=degree1;i>=0;i--) { if(head==NULL) { head=new p; head->coefficient=arr[i]; head->degree=i; head->link=NULL; } else { temp=head; while(temp->link!=NULL) … |
+0 forum
1 | ||

So essentially I'm prompting the user for two binary numbers. How can I add these together? I don't know how to get the 0b in front the the original input. If there is an easier way to do it, please let me know. #Prompt the user for two binary numbers bin1 = raw_input("Please enter a binary number: ") bin2 = raw_input("Please enter another binary number: ") binstr1 = str(bin1) binstr2 = str(bin2) #Check to verify that the user input two binary numbers while '1' and '0' in binstr1, binstr1: print str(binstr1) else: binstr1 = raw_input("You did not enter a binary … |
+0 forum
1 | ||

Dear Sir/Madam, I have created a sample program that dynamically created up to 7 numbers of Labels and Text Boxes. Here I want to add those numbers inputted by user on dynamically created text boxes. I have tried a lot but all are in vain. Please guide me to solve this problem. I have attached my test program. |
+0 forum
4 | ||

I created a console program in jcreator (java) which asks the user to enter a number in string and converts that string value into char array and then converts each char array into an integer which I also stored each as an array and then adds all the value from integer array and prints the total on the screen. Someone says its not the solution he is looking for and that I shouldnt use string and I need to focus on the integer value. Is there any other way of doing this as unlike my program? if there is, can … |
+0 forum
4 | ||

Hello I have problem with adding two numbers that are less than 10 and their result is more than 10. [CODE]#include <iostream> #include <sstream> #include <string> using namespace std; typedef class node * node_pointer; class node { public: int num; node *nxt; }; string reverse (string str) { int len = str.length(); string tmp = ""; const char *data = str.data(); int i; for( i=len; i>=0; i--) { tmp += data[i]; } return tmp; } node_pointer readingTokens(string& str) { node_pointer head = NULL; node_pointer curr = NULL; const char* data = str.data(); for(int i = 1; i<str.length(); i++) { node_pointer … |
+0 forum
1 | ||

Hello, :?: I need help with adding int arrays i got the everything working except for when i need to carry more than once and if the carry isn't in the ones digit honestly i can't think of anything :$ any ideas, suggestion, code would be welcomed [CODE] public class BCD { private int[] digits; BCD(int num){ int DIGIT=num%10; num=num/10; digits=new int[1]; digits[0]=DIGIT; while(num>0){ DIGIT=num%10; addADigit(DIGIT); num=num/10; } public void addADigit(int newdigit){ int[] Digi= new int[digits.length+1]; Digi[digits.length]=newdigit; for(int i=0; i<digits.length; i++){ Digi[i]=digits[i]; } digits = Digi; } public BCD addBCDs(BCD other){ int[] dig={}; BCD addedBCD=new BCD(dig); //int[] carry={}; int carry=0; … |
+0 forum
0 | ||

We know that 0.1 + 0.1 + 0.1 - 0.3 = 0.0 But in python 0.1 + 0.1 + 0.1 - 0.3 = 5.5511151231257827e-017 Is there any way I can get 0.0...?? |
+0 forum
5 | ||

How do you perform hexadecimal addition in C++? like ACD2 + 23E1 = D0D3 5A72 + 4573 = 9FE5 ___________________________________________________ the addends will be asked by the program then the program should show the sum ___________________________________________________ the addends required are only 2 |
+0 forum
2 | ||

I'm trying to do addition of matrices using pointers. But, in 3x3 matrix, only the first row of the matrix gets added, while the rest are zero. Please help me correct this. Thank You! My code is as follows :: [CODE] #include<stdio.h> #include<conio.h> int a[10][10],b[10][10],c[10][10]={0}; int i=0,j=0,k=0; int r1,c1,r2,c2; void *matrixAdd(int*,int*); void printMatrix(int*); int main() { create(); getch(); return 0; } void create() { printf("\nFor Matrix A --->\n"); printf("\nEnter Number Of Rows :: "); scanf("%d",&r1); printf("\nEnter Number Of Columns :: "); scanf("%d",&c1); printf("\nFor Matrix B --->\n"); printf("\nEnter Number Of Rows :: "); scanf("%d",&r2); printf("\nEnter Number Of Columns :: "); scanf("%d",&c2); … |
+0 forum
1 | ||

Hey everyone :) So I'm doing my homework when I get this massive brainfart. It's all done, and everything works, except I need a way to make [B]j[/B] [in the function AddStudents()] get bigger without resetting to 0 everytime the function is called (so it moves to the next cell in the array). But I can't figure it out O.o Any ideas? p.s. I would put it in a for loop but the homework says it should only be called once and then the user should have the option to add another student. [CODE] #include <iostream> using namespace std; class … |
+0 forum
3 | ||

I figured it out. To return an array you need to write your function as so [CODE] int *foo() {} [/CODE] |
+0 forum
2 | ||

I'm a total newbie and.. with the code above.. What I want to do is have 10 dValue numbers, but if, of those 10 I only enter 5 values, the exe shouldnt ask me to enter all 10 and just add the 5 values I entered when I press the return key .. or something like that[code]// // Add 3 numbers // #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(int nNumberofArgs, char* pszArgs[]) { double dValue1; double dValue2; double dValue3; // enter three numbers cout << "This program adds three numbers;\n"; cout << "Enter three integers:\n"; cout … |
+0 forum
2 |

The End.