Search Results

Showing results 1 to 40 of 135
Search took 0.03 seconds.
Search: Posts Made By: Rashakil Fol ; Forum: C and child forums
Forum: C Oct 14th, 2009
Replies: 1
Views: 286
Posted By Rashakil Fol
When it scans, the object will be one color and the background will be another, right? Count the number of pixels that are the object's color. And multiply that by the area of a pixel.
Forum: C Sep 23rd, 2009
Replies: 6
Views: 223
Posted By Rashakil Fol
Make a poop simulator.
Forum: C Sep 23rd, 2009
Replies: 6
Views: 223
Posted By Rashakil Fol
Make a GUI application using GTK+ 2.



Use your coding skill to make stuff.
Forum: C Sep 10th, 2009
Replies: 3
Views: 320
Posted By Rashakil Fol
And let's not forget about alignment issues, recursive functions, data structures, and anything whose size depends on user input.
Forum: C Mar 8th, 2009
Replies: 3
Views: 1,176
Posted By Rashakil Fol
calloc initializes the memory with zero. calloc = clear + alloc
Forum: C Feb 28th, 2009
Replies: 8
Views: 473
Posted By Rashakil Fol
Presumably he has random access to the list; otherwise this problem would be impossible.

The answer is pretty simple, and we're not just going to give you the answer.

Here's a hint though: ...
Forum: C Feb 18th, 2009
Replies: 12
Views: 1,887
Posted By Rashakil Fol
You're mistaking zero for Zorro. Get it right.
Forum: C Jan 28th, 2009
Replies: 12
Views: 1,887
Posted By Rashakil Fol
I still don't get why you bother adding zero.
Forum: C Jan 28th, 2009
Replies: 12
Views: 1,887
Posted By Rashakil Fol
Yes. In general, you should make a function

int random(int n) {
return (int) (n * (rand() / (1.0 + RAND_MAX)));
}

and use that to generate a random number from 0 to n-1. With a decent...
Forum: C Jan 26th, 2009
Replies: 2
Views: 332
Posted By Rashakil Fol
There are none.

Well, there are a few. If you don't have a C++ compiler that targets the platform you're looking for, or if you're working on a project (that somebody else started) that uses C...
Forum: C Jan 26th, 2009
Replies: 12
Views: 1,887
Posted By Rashakil Fol
Probably because you're assigning an element past the end of the array, and there's a variable there that throws off your code unpredictably.

Also, you've already showed a way to change that...
Forum: C Nov 28th, 2008
Replies: 2
Views: 420
Posted By Rashakil Fol
message_to_network should already be a function that waits for a new message to reach the socket. I'm guessing about its implementation, but you should just need to call that function -- it will...
Forum: C Nov 9th, 2008
Replies: 2
Views: 3,204
Posted By Rashakil Fol
Haskell version:

main = do putStr "Enter the number: "
n <- readLn
putStr "\n\nThe representation : "
putStrLn . intercalate " " . map ((names !!) . digitToInt ....
Forum: C Feb 9th, 2008
Replies: 15
Views: 2,986
Posted By Rashakil Fol
Here's a rather neat solution that is relatively portable. It only reverses bytes though.

unsigned int reverse_bytes(unsigned int n) {

#if UINT_MAX > 4294967295

n = ((n &...
Forum: C Sep 26th, 2007
Replies: 3
Views: 3,455
Posted By Rashakil Fol
I'd add

4. Caller makes a char*, passes a pointer to the char** to the callee, and the callee sets the caller's char* to point to some freshly allocated memory, with the caller's responsibilty to...
Forum: C Jul 16th, 2007
Replies: 7
Views: 2,745
Posted By Rashakil Fol
Well, first, do you know anything about parsing, or just about recursion? Because you'll have to use a bit of that, for your program to understand the expressions the user types in.
Forum: C Jun 29th, 2007
Replies: 7
Views: 1,205
Posted By Rashakil Fol
Use a heap ^_^ to store the top two elements as you walk through the array. Then finding the top K elements takes O(N log K) time instead of O(N log N).
Forum: C Jun 29th, 2007
Replies: 6
Views: 7,105
Posted By Rashakil Fol
That doesn't involve function pointers though :-/

Mentioning function pointers must be a sign of being completely lost, since there's only a finite constant set of values a function pointer can...
Forum: C Jun 29th, 2007
Replies: 6
Views: 7,105
Posted By Rashakil Fol
I am very confused. How in the world are you going to implement a stack using function pointers?
Forum: C May 10th, 2007
Replies: 3
Views: 7,006
Posted By Rashakil Fol
First, the program communicates with the operating system differently. To perform input and output, it must talk to the OS with a system call, using a particular protocol, and they use different...
Forum: C May 6th, 2007
Replies: 1
Views: 2,329
Posted By Rashakil Fol
- I don't understand the question.
- The expression (&T) returns a value of type nodeptr**, when T is of type nodeptr*, but insert expects an argument of type nodeptr*.
- Case 10 doesn't change the...
Forum: C May 4th, 2007
Replies: 6
Views: 1,226
Posted By Rashakil Fol
Then that's not the case, since RECT and POINT both use LONGs. Maybe you should look closely at the behavior of Get_Mouse() and see what it outputs.
Forum: C May 4th, 2007
Replies: 6
Views: 1,226
Posted By Rashakil Fol
It seems that you're using an unsigned integer to represent your coordinates. When you decrement an unsigned integer, such as 0, instead of getting -1, you get the highest possible value the integer...
Forum: C May 4th, 2007
Replies: 36
Views: 7,360
Posted By Rashakil Fol
Not to mention that his very own example is still unsafe!
Forum: C May 2nd, 2007
Replies: 1
Views: 1,148
Posted By Rashakil Fol
Open up synaptic and search for wxwidgets or just 'wx'.

By the way, your shift key's broken.
Forum: C May 1st, 2007
Replies: 13
Views: 1,695
Posted By Rashakil Fol
Come to think of it, it's not even correct. However, the code I gave (despite its uselessness) is only 3 bytes longer than the OP's code when compiled under GCC -O3.

The...
Forum: C May 1st, 2007
Replies: 2
Views: 2,741
Posted By Rashakil Fol
alloc.h is a nonstandard header file. What are you trying to compile with?
Forum: C May 1st, 2007
Replies: 13
Views: 1,695
Posted By Rashakil Fol
Maybe
int i = p * q << 12;
int j = (i >> (sizeof(int)-1) * CHAR_BIT) & (~0xF)
i = (i & j) | (~ j);
Forum: C Apr 30th, 2007
Replies: 2
Views: 1,244
Posted By Rashakil Fol
Forum: C Apr 30th, 2007
Replies: 4
Views: 1,267
Posted By Rashakil Fol
You could write a full-blown HTML parser, you could use somebody else's HTML parser, or you could use a cheapo solution that looks for strings like NZD-USD and walks their way forward through values....
Forum: C Apr 27th, 2007
Replies: 2
Views: 903
Posted By Rashakil Fol
No. Gently caress you. Do your own homework.
Forum: C Apr 14th, 2007
Replies: 5
Views: 3,914
Posted By Rashakil Fol
I don't think that's what the question's asking, Lerner. It doesn't say that.

shmay, if you need to generate a number in the range [0, 37) with five random decimal digits after the decimal point,...
Forum: C Mar 31st, 2007
Replies: 17
Views: 6,923
Posted By Rashakil Fol
You could create a lazy list datatype that only produces values when you request them -- and whose values it produces are the natural numbers. Then run the sieve of Eratosthenes on it. Then peel...
Forum: C Mar 13th, 2007
Replies: 1
Views: 711
Posted By Rashakil Fol
Forum: C Dec 4th, 2006
Replies: 6
Views: 5,490
Posted By Rashakil Fol
Also, more portable, since you're not making assumptions about character set.
Forum: C Nov 27th, 2006
Replies: 3
Views: 1,797
Posted By Rashakil Fol
What happens when you compute fact(13)? The number is too large to be represented by a long (which has range up to 2^31-1, approximately 4 billion). That messes up the computations at that point.
Forum: C Nov 17th, 2006
Replies: 2
Views: 1,531
Posted By Rashakil Fol
http://eternallyconfuzzled.com/tuts/hashing.html
Forum: C Oct 8th, 2006
Replies: 7
Views: 1,578
Posted By Rashakil Fol
You can use % 10 to find the units digit of a number. For example, n % 10 gives the units digit of n. You can then use / 10 to divide an integer by ten. For example, n / 10 divides n by ten.
...
Forum: C Sep 11th, 2006
Replies: 11
Views: 5,054
Posted By Rashakil Fol
Well, I was kind of joking when I said straightforward :)

But anybody with a good understanding of basic algebra could be taught how to do this and understand how it works.

Also, anybody...
Forum: C Sep 11th, 2006
Replies: 11
Views: 5,054
Posted By Rashakil Fol
Yeah, there's a simple and straightforward algorithm for this.

The first step is to understand how to represent a linear system of equations with matrices and how to solve that with a computer...
Showing results 1 to 40 of 135

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC