578 Topics

Member Avatar for
Member Avatar for NH1

What if the number i want to round is a decimal.? [code=c] /// <summary> /// Rounds a number to the closest multiple of another number. /// </summary> /// <example>83 rounded to closest 25 would give a value of 75 (83 is closer to 75 than 100)</example> /// <param name="num">The number …

Member Avatar for jbisono
0
181
Member Avatar for jeffsbaker

Does anyone know why the following subquery is using filesort and scanning all rows in the table according to EXPLAIN? I am trying to get the total of the top ten scores and the result is fine. [CODE]EXPLAIN SELECT SUM( score ) AS top10_total FROM ( SELECT score FROM answers …

Member Avatar for tesuji
0
1K
Member Avatar for nekogda

Here's a simple question. Need: => to use scipy special package function in my python prog (python2.6). 1. Downloaded & intalled numpy for python2.6 2. Downloaded & intalled scipy (scipy-0.8.0-win32-superpack-python2.6.exe) tested: import numpy import scipy - everything's ok According to scipy docs, a package needs to be loaded before a …

Member Avatar for nekogda
0
209
Member Avatar for lukefuller

Hi All, I have been pulling my hair out over this one. What we are trying to do is pull sum values for the same item out of three different tables in the same DB (MSSQL '05) – Should be quite straight forward however... The result should look a bit …

Member Avatar for tesuji
0
157
Member Avatar for kymarscheng

I have made a program to test if the string entered is a palindrome or not. Here's the source code: [code=c]#include <stdio.h> #include <ctype.h> #include <string.h> void clrsp(char *); void rev(const char *,char *); int main() { char str1[80],str2[80]; printf("Enter a string: "); fgets(str1,80,stdin); str1[strlen(str1)-1]='\0'; //eliminate newline clrsp(str1); //clear spaces …

Member Avatar for urjapandya
0
150
Member Avatar for AkashL

I have heard you can efficiently use your GPU to do fast floating point calculations. This can be done using OpenGL but you may have to use the library in an unorthodox way or graphics card toolkits such as CUDA (by nVidia) which I guess is Graphics card specific. Does …

Member Avatar for 0x69
0
153
Member Avatar for AkashL

I have heard you can efficiently use your GPU to do fast floating point calculations. This can be done using OpenGL but you may have to use the library in an unorthodox way or graphics card toolkits such as CUDA (by nVidia) which I guess is Graphics card specific. Does …

0
111
Member Avatar for crapgarden

[COLOR="Red"]3.2 - Defining and Differentiating Computation. [] vs ()[/COLOR] I'm trying to get a solid fix on how math computations work in C++ and how to declare their order, in particular with respect to ( ) operators. this adds to an array: [CODE] inventory[numItems++] = "armor".[/CODE] why don't I need …

Member Avatar for crapgarden
0
127
Member Avatar for jefferlyn92

create a method sumOfDigit(String str) compute and display the sum of the digits found in str Example: String str = "1234hello12678"; sumOfDigit(str) -> returns 34 ---need some codes guys! can you HELP me?!

Member Avatar for ANDIEniable
0
647
Member Avatar for Mikey12345

Hi, Is there a frequency function in C# like there is in Excel. I need to show a distribution chart in bell curve form. Thanks

Member Avatar for ddanbe
0
1K
Member Avatar for midget66

I am working on a program in c and I am trying to declare a ten element array, using a for loop to insert the elements. I am also using a second for loop to acquire the sum of all the elements in the array. I'm new to programming so …

Member Avatar for midget66
0
90
Member Avatar for debragail

The following code iteratively calculates continued fractions. I'm having trouble separating the numerator and denominator from the returned value. [code=python]def cf3(terms, iterations): answer = 0 for n in range(iterations, 0, -1): answer = Fraction(1, terms[n] + answer) answer += Fraction(terms[0], 1) return answer [/code] The following is sample output showing …

Member Avatar for debragail
0
180
Member Avatar for cadtel

Hi all, this is my first post. A couple days ago, in preparation for a math final, I attempted to code a program which would allow me to solve triangles (law of cosines, sines, etc.). Now that the test is over, I am now interested in getting it working. [CODE]#This …

Member Avatar for TrustyTony
0
190
Member Avatar for ppotter3

Hello! My name is Page, and I am learning how to code in Java. I am working on a program, and it was homework at one time, but the assignment due date is passed. I would just like to get it going so I can learn from my mistakes, and …

Member Avatar for NormR1
0
711
Member Avatar for freiheit

Hello all I have this query [CODE]$query_Totals_i = "SELECT (kinisis_1c + kinisis_1e + ((kinisis_1c / kinisis_1b) * kinisis_1a)) * (1 - fpa) * 1.005 AS kinisis_1, (100c+ 100e+ ((100c/ 100b) * 100a)) * (1 - fpa) * 1.005 AS `100ara`, (super_1c + super_1e + ((super_1c / super_1b) * super_1a)) * …

Member Avatar for rajarajan2017
0
103
Member Avatar for arthurav

Given the degree of the polynomial and a vector with the polynomial's coefficients is there a more efficient way to recursively calculate the polynomial result for a given x? This is what i have tried, and it works, but I am asking if there is a more efficient way to …

Member Avatar for arthurav
0
3K
Member Avatar for b89smith

I am printing out a double from a sql database. When it prints out it prints in scientific notation, but i want it to print out 0.00005 instead of 5E-5. Thanks

Member Avatar for cwarn23
0
92
Member Avatar for DerKleineDude

Hello, I'm a Python/SPSS (DANIWEB) beginner and I'm having a hard time getting classes, functions and methods into the right order. I want to write a script for SPSS where I can read text out of an text object from the SPSS-output file. My code looks like this: [CODE=Python] import …

Member Avatar for DerKleineDude
0
456
Member Avatar for NathanOliver

Hey all I have seen a lot of stuff about palindrome checkers so I thought I would write one that works for STL containers as well as arrays. it accepts a bidirectional iterator to the first element and an bidirectional iterator to 1 after the last element. Included is a …

Member Avatar for NathanOliver
3
328
Member Avatar for panda_pow

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 …

Member Avatar for panda_pow
0
147
Member Avatar for wade2462

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

Member Avatar for wade2462
0
96
Member Avatar for Tvirusx1

I just can't seem to solve this. Heres what I want to do: I want my program to calculate movement, from one point to another. The function _updatepos is the main function, where I have troubles. It is supposed to, as the name says, update the position (posx and posy), …

Member Avatar for Tvirusx1
0
153
Member Avatar for Big-D2xL

Hi, I know this forum for a while and it has been helping me for a time, now I registered myself and I have a question to make you: I'm making a zone in my website where I can see a Top10 of links, products and news, and all of …

Member Avatar for Big-D2xL
0
184
Member Avatar for nwhitesel

Hi everyone! I am working my way through some problems from projecteuler.net and came across one that has stalled me. The task is to find the sum of all primes under 2,000,000. I am attempting to use the Sieve of Eratosthenes algorithm for identifying prime numbers. Here is my code …

Member Avatar for nwhitesel
0
220
Member Avatar for SanjitVigneshS

I was attempting a problem on [URL="http://projecteuler.net/"]Project Euler[/URL] - Problem 20. Since 100! could not be stored as ulong, I was thinking of using hexadecimal. Though I find a lot of example of converting hexa to decomal and vice - versa, I cannot find any info on using it in …

Member Avatar for SanjitVigneshS
0
91
Member Avatar for Santho786

Presently in this below code, I have 4 dynamic values, end user will be select degree from combo box, entering the values semester, Max marks and Obtained marks as numeric values. Once entered dynamic rows will be created and it also calculate the percentage by the formula (om/mm)*100 for each …

Member Avatar for Santho786
0
133
Member Avatar for jd_davis

Greetings, I've been given a challenge to build a simple game for my daughter. The idea is that you smash the spacebar, and a ball drops into the game, goes down some ramps, and lands at the bottom. Being a newbie programmer, this is becoming a challenge. I decided to …

Member Avatar for ddanbe
0
207
Member Avatar for aldm

Hi to all, I'm solving some numerical analiyse problems in C#. Is there any C# implemented function similar to eval() in Matlab? So, user type the function that he wants to evaluate in text box, and eval(String s, double x) evaluate value of that function with argument x. For example, …

Member Avatar for aldm
0
620
Member Avatar for Santho786

Hi, I have an array of integers I like to retrieve the max number and index of max number from that array without using Math.Max() function.. Presently in this below code, I have 4 dynamic values, end user will be select degree from combo box, entering the values semester, Max …

Member Avatar for Santho786
0
229
Member Avatar for kjock002

[CODE] # PURPOSE: to calculate the sum of the first (n) counting numbers # # INPUT(S): the number (n) which will be the last number added to the sum # # OUTPUT(S): the sum of the first (n) counting numbers # # EXAMPLES: input: 4 ; output: 10 # input: …

Member Avatar for Gribouillis
0
114

The End.