I am working on a code that searches a folder gets a specific part of the file name and adds 1 to a file counter. There are some files in tehre that have a special character that indicates that is is only half. I ahve got it to count the full ones but can not figure out a way to get the half ones to count. The special character that is in the names to inficate half is H. If someone could please help me figure this out it would help increase my production time. def bedCount(pathname, bednumber): filecount = …

Member Avatar
Member Avatar
+0 forum 3

Here is my code. I have a problem with the decimals when it comes to "temp /= 100.0". montant = 61; for (int i=0 ; i<7 ; i++) { if (i != posCreancier) { temp = montant/7.0; (temp == 8.7142857142857135) temp *= 100; (temp == 871.42857142857133) temp += 0.5; (temp == 871.92857142857133) temp = floor(temp); (temp == 871.00000000000000) temp /= 100.0; (temp == 8.7100000000000009) Wtf with that "9" appearing ?!? tabDettes[posCreancier][i] = temp; } }

Member Avatar
Member Avatar
+0 forum 4

can someone give me an idea how I limit the decimals in the output of this code: /** * @(#)Text1.java * * * @author Bryan Mark * @version 1.00 2012/8/4 */ import java.io.*; public class Converter { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); double farenheit, celsius; System.out.println("Enter a value for Farenheit: "); farenheit = Double.parseDouble(br.readLine()); celsius = (5.0/9) * farenheit - 32; System.out.println("Farenheit " + farenheit + " = " + celsius + " Celsius"); } } this is a sample output.. > Enter a value for Farenheit: > 29.5 > Farenheit 29.5 …

Member Avatar
Member Avatar
+0 forum 2

So basically this is suppose to be a grade calculator and the program works, I now just have to put it into a do-while loop so it can work for more than one student. My professor wants it to say Y for another student and N to quit at the end. I'm having a hard time figuring how to make that work. Also he wants the averages to come out to two decimal places even if its just 88.00 but it isn't working when I use setprecision. Any suggestions would be grealy appreciated. #include <iostream> #include <iomanip> using namespace std; …

Member Avatar
Member Avatar
+0 forum 21

Little clean up of vegaseat's code for generating pi decimals. Added number of decimals desired and string type return for easy use with ''.join()

Member Avatar
Member Avatar
+1 forum 4

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...??

Member Avatar
Member Avatar
+0 forum 5

I am making a simple unit converter, and wanted the user to specify the number of decimal places to be displayed for the results. The user selects which conversion they want to perform from another combo box, and I have a select case to decide the calculation needed. Eg. [code]Select Case cboUnitType.SelectedIndex Case 0 'grams to ounces lcUnit2 = lcUnit1 * CSng(0.00220462262) lblUnitResult.Text = CStr(lcUnit2) Case 1 'ounces to grams lcUnit2 = lcUnit1 / CSng(0.00220462262) lblUnitResult.Text = CStr(lcUnit2) Case 2 'kilograms to stones [/code] etc. Everything works fine here, but I am unsure how to use another combo box to …

Member Avatar
Member Avatar
+0 forum 4

I am writing a function to extract decimals from a number. Ignore the exception and its syntax, I am working on 2.5.2 (default Leopard version). My function does not yet handle 0's. My issue is, the function produces random errors with certain numbers, and I don't understand the reason. I will post an error readout after the code. Function: [ICODE]def extractDecimals(num): try: if(num > int(num)): decimals = num - int(num) while(decimals > int(decimals)): print 'decimal: ' + str(decimals) print 'int: ' + str(int(decimals)) decimals *= 10 decimals = int(decimals) return decimals else: raise DecimalError(num) except DecimalError, e: e.printErrorMessage()[/ICODE] Exception Class: …

Member Avatar
Member Avatar
+0 forum 4

The End.