Hi all...my question is how would I change the program below so that it takes a file descriptor number on the command line rather than a file name? Any help would be greatly appreciated. Thank You.
include "csapp.h"
int main (int argc, char **argv)
{
struct stat stat;
char *type, *readok;
/* $end statcheck */
if (a...
Is it possible without using exponentiation to have a set of numbers that when added together, always give unique sum?
I know it can be done with exponentiation (see first answer): http://stackoverflow.com/questions/1619379/the-right-way-to-manage-user-privileges-user-hierarchy
But I'm wondering if it's possible without exponentiation....
Using PHP I want to do millions of 2^n exponentiation but so far I only got up to n^1023 before PHP printed INF.
Any ideas?
...
I want to make a short URL service for 2 million assets but I want to use the shortest number of possible characters.
What is the math equation that I would need to use to figure it out? I know it has something to do with factorials, right?
...
I am designing a website.I want to validate the mobile no. entered by the user on the registration page, by sending a verification code to his mobile phone. Can anyone give me pointers to how should i proceed with it??
...
This is my BMI calculator with GUI. It compiles, but if the user enters characters rather than numbers into the fields, the program crashes. What is wrong with my catching of the numberformatexception? Id appreciate any help!
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Exercise1b extends JFrame{
JLabel BMIl...
Is there a way to specify total number of characters when formatting doubles?
Lets say I have 0.00012345678, and I specify total number of characters (7), I want to get 1.23e-4. Format "G7" would give 1.2345e-4.
More examples:
0.00000012345678F -> 1.23e-7
0.00012345678F -> 1.23e-4
0.12345678F -> 1.23e-1
1.2345678F -...
I found this interesting question about converting numbers into "words":
http://stackoverflow.com/questions/309884/code-golf-number-to-words
I would really like to see how you would implement this efficiently in Erlang.
...
After becoming more engaged with training new engineers as well as reading Jon Skeet's DevDays presentation I have begun to recognize many engineers aren't clear when to use which numeric datatypes when. I appreciate the role a formal computer science degree plays in helping with this, but I see a lot of new engineers showing uncertainty...
Here is my code:
double round( char* strNumber, int decPlace);
int main()
{
int decimal;
char initialNumber[256];
cout << "Enter decimal and number " << endl;
cin >> decimal;
cin >> initialNumber;
cout << setprecision (15) << round ( initialNumber,decimal ) << endl;
return 0;
}
double round( char* str...
Hi, I have these numbers:
5.25
10251.35
5
and I want them to be formatted with groups and always with 2 decimals ,XX
this is what .ToString("N2") does:
5,25
10.251,35
5
How can i make the '5' look like 5,00 too ?
And for multiple cultures of course (en: 5.0, de: 5,0 ...)
In fact this question has no sense, N2 should do it at all...
From one of VBA tutorials I learned that variables contining numbers should be firstly declared as integers:
Dim mynumber as integer
But, please, look at this code:
Sub math()
A = 23
B = 2
ABSumTotal = A + B
strMsg = "The answer is " & "$" & ABSumTotal & "."
MsgBox strMsg
strMsg = "The answer is " & "$" & Sqr(AB...
Is there any way to get mother board serial number without using WMI and without authentication of remote machine.
...
I am writing a thesis heavy with Definitions, Theorems, Lemmas and the like. I need to give a basic definition of a concept, and then later in the thesis expand on this definition as more parameters add to the complexity and thus to the definition. So I need something which would look (structurally) like this:
Definition 1
Definition 2...
How do I quickly generate a random prime number, that is for sure 1024 bit long?
...
If i have a variable $num = 50 how can i put numbers 1-50 into an array?
(50 is an example.. i wont know how many questions)
...
Hello
I want to check if a string contains only digits. I used this:
var isANumber = isNaN(theValue) === false;
if (isANumber){
..
}
.. but realized that it also allows + and -. Basically I wanna make sure the input contains ONLY digits and no other letters. Since +100 and -5 are both numbers, isNaN, is not the right way to go.
...
How do you write a java program using a recursive method that takes in an int like "234" and converts this into the corresponding letters on a phone pad (2 = ABC, 3 = DEF, etc), and prints out the permutations of this? e.g.:
input = 234
output = ADG ADH ADI AEG AEH AEI AFG AFH AFI BDG BDH BDI BEG BEH BEI BFG BFH BFI CDG CDH CDI CEG CEH...
I'd like to round integers down to their nearest 1000 in Java.
So for example:
13,623 rounds to 13,000
18,999 rounds to 18,000
etc
...
I'd like to write a program that lets users draw points, lines, and circles as though with a straightedge and compass. Then I want to be able to answer the question, "are these three points collinear?" To answer correctly, I need to avoid rounding error when calculating the points.
Is this possible? How can I represent the points in mem...