578 Topics
| |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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?! | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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)) * … | |
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 … | |
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 | |
| 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 … |
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 … | |
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 … | |
I figured it out. To return an array you need to write your function as so [CODE] int *foo() {} [/CODE] | |
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), … | |
| 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 … |
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 … | |
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 … | |
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 … | |
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 … | |
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, … | |
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 … | |
[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: … |
The End.