1,684 Posted Topics

Member Avatar for dassnagar
Member Avatar for Rashakil Fol
0
161
Member Avatar for degamer106

You're right; this isn't really recursion; you're just making a cute loop (and never returning :-)). Once you get this working properly, the stack datastructure you are currently using will be replaced by the chain of recursive calls (which in a way, can be thought of a datastructure, too). Here …

Member Avatar for Lerner
0
332
Member Avatar for smart girl

You can tell yourself. You understand how every individual part works, right? So simulate the code by hand, and you'll see where it's going wrong.

Member Avatar for smart girl
0
120
Member Avatar for riscphree

In C and C++, the 'double' datatype can be used to store approximations of the real numbers. For example, [inlinecode]double x = 3.5;[/inlinecode]. Use doubles to store all your resistances, and then you can do approximate arithmetic on them. These approximations can store about fourteen decimal digits of precision. They're …

Member Avatar for riscphree
0
335
Member Avatar for qljolly

[QUOTE=qljolly]I have been working on this for the past week and i am almost done but i dont know why my program keeps crashing at the end game check and also it doesnt realize that there is a piece that interrupts the connect four if it were like XXXOX it …

Member Avatar for Rashakil Fol
0
164
Member Avatar for Dani
Member Avatar for stallion88
Member Avatar for Rashakil Fol
0
552
Member Avatar for chelo77

I don't know how much you know so apologies if I repeat stuff you already know. Your constructor that uses no arguments is not assigning anything as the value of numerator and denominator. For that reason, whatever happened to be stored in memory at the physical location of numerator and …

Member Avatar for iamthwee
0
790
Member Avatar for neno14me

If you're thinking about "relationships" like association, containment, and such, then you're not thinking about solving the problem. Think about what your program would be doing when running minesweeper, and then the classes that you find convenient to use will fall out directly from the types of objects you're thinking …

Member Avatar for iamthwee
0
538
Member Avatar for skeet123

[QUOTE=Narue]If you're really interested in being precise, you can work out a detailed analysis based on the increasing inner loop iterations. But that's not always worth it, and certainly not for this question.[/QUOTE] To give an example of what Narue's talking about, it's not too hard to see that the …

Member Avatar for Rashakil Fol
0
225
Member Avatar for amnezia

This is fairly straightforward to write. [url]http://planetmath.org/encyclopedia/CubicFormula.html[/url]

Member Avatar for SpS
0
1K
Member Avatar for lionsh

Prove it for the cases where N is one less than a power of two. Then, as you add new elements across the new bottom row, find a pattern into how much each individual element contributes to the total possible number of comparisons.

Member Avatar for Rashakil Fol
0
87
Member Avatar for lionsh

lionsh, were you told that this is possible? I have a feeling it isn't possible.

Member Avatar for Rashakil Fol
0
53
Member Avatar for puppy

= is the assignment operator, not equivalence test operator, and you probably declared a as const.

Member Avatar for puppy
0
101
Member Avatar for proxy_x

What you do mean, "access their computer"? A computer at home? This is probably not the right forum for this question.

Member Avatar for Rashakil Fol
0
60
Member Avatar for nizzy1115

What is this disease that people have which causes them to want their PCs to look like Mac OS X? This is the saddest thing ever.

Member Avatar for MIGSoft
0
213
Member Avatar for jglw

First, what if stdin doesn't contain a newline character? You've got an infinite loop, then. Second, your linked list is finishing off with a node whose tail pointer (and character) is uninitialized. Third, if the value passed for N is null, then the caller cannot see the linked list you've …

Member Avatar for orko
0
277
Member Avatar for hot.com
Member Avatar for Rashakil Fol
0
68
Member Avatar for Spasticmoose

I think a neat, but relatively simple problem, would be to create an reverse Polish notation calculator. It would take a line of input, like, 2 3 + 5 *, and display 25. You'd need to understand what reverse Polish notation is; you can look online, probably Wikipedia. Or try …

Member Avatar for Spasticmoose
0
173
Member Avatar for grunge man

> Note that you should use square brackets, [ and ], rather than the curly brackets, { and }, in the tags I mentioned. Oh, so you're saying we should use code tags? :D

Member Avatar for Narue
0
168
Member Avatar for blackdove
Member Avatar for alexstanley
Member Avatar for porterrj

This requires some basic algebra. 80 = 2m + w, where w is the width of the rectangle, m is the width of the margin.

Member Avatar for Bench
0
175
Member Avatar for thehakan

Here is Narue's tutorial on finding O notation bounds, which has had success with some learners: [url]http://eternallyconfuzzled.com/articles/bigo.html[/url] Here is my tutorial, which was helpful to one person looking for a more precise definition. It was written more as a clarification than an introduction. [url]http://shobadobs.com/tuts/big_o.html[/url] There's Wikipedia and MathWorld, but their …

Member Avatar for thehakan
0
88
Member Avatar for njzillest

[QUOTE=njzillest]I started C++ a few weeks ago.. I want to go to MIT for computer science, and for that i want to learn a few computer languages.[/QUOTE] Go ahead, let the rest of your life be decided by a ninth grader. (Hehehe.) [QUOTE=njzillest]I know how to make loops and random …

Member Avatar for Rashakil Fol
0
98
Member Avatar for degamer106

[QUOTE=degamer106]- How do I get the one's complement operator ~ to work? I've tried inserting it here and there but all i get is smiley faces or some funky symbols. [/QUOTE] The one's complement operator subtracts your number from the maximum possible unsigned integer that can be stored. For example, …

Member Avatar for degamer106
0
91
Member Avatar for vieome

Unfortunately, it gives the idiotic FOX News side of the story. Of course, all news channels are idiotic. But I don't get what FOX News has to do with Daniweb.

Member Avatar for DMR
0
503
Member Avatar for Dabdob
Member Avatar for Dabdob
-1
172
Member Avatar for cancer10
Member Avatar for Yustme

[QUOTE=Narue]If flipbit doesn't return a value, you need to pass a reference so that any changes are reflected back in the calling function: [code]void flipbit(unsigned& a, unsigned b)[/code][/QUOTE] Yustme, note that what Narue posted is valid C++ code, but not C code (and it looks like you're using C based …

Member Avatar for Narue
0
2K
Member Avatar for Kiba Ookami

The main use of the factorial function is that it's the Hello World of recursive functions. Along with the Fibonacci numbers, it is the first example used in many classes. Computing individual factorials is usually not useful. But understanding the concept may be useful. They are often found in formulas …

Member Avatar for iamthwee
0
196
Member Avatar for degamer106

[QUOTE=iamthwee]That way [b]we[/b] don't have to correct your silly mistakes.[/QUOTE] dubeyprateek: Please don't consider iamthwee's style of response to be representative of anybody else's attitudes here.

Member Avatar for Narue
0
141
Member Avatar for aj6594

If it's a substantial amount of money, then you can afford to buy some extra cheap computers.

Member Avatar for alc6379
0
64
Member Avatar for Dani

I've spotted a bug! The google ads have images in them!! Okay, it's just St. Patrick's Day. Never mind...

Member Avatar for Narue
0
76
Member Avatar for sportsnut941

Nice to meet you. Maybe you meant 'else if'? This is not the right forum for your question.

Member Avatar for Rashakil Fol
0
34
Member Avatar for webmasts

You know how to make a simple truth table, right? For example, [code] a | b | a AND b ---+---+--------- F | F | F T | F | F T | T | T F | T | F[/code] If you want to make a truth table for …

Member Avatar for Lord Soth
0
237
Member Avatar for benyam_dessu
Member Avatar for Rashakil Fol

I'm being shown threaded mode for some reason, while my preferences say otherwise. [edit: Okay, it looks like I can change it.] But still, threaded mode on by default is a bad idea. Threaded discussion structures are a bad idea in general; they only got created in the first place …

Member Avatar for Rashakil Fol
0
210
Member Avatar for vurdlak

Write them in English, and don't be wrong, and they'd be much better.

Member Avatar for iamthwee
0
141
Member Avatar for gampalu

[QUOTE=Narue]Alternatively, if all you need is to print the rounded double, any formatted output option will do it for you (which opens up ideas for those clever workarounds I was talking about).[/QUOTE] Eww! That would just be sick.

Member Avatar for gampalu
0
108
Member Avatar for tayspen
Member Avatar for minorityreport

Um, why would you even [i]expect[/i] this code to work? Do equalsList, precedesList, and stringToList work as advertised?

Member Avatar for Narue
0
299
Member Avatar for Dani
Member Avatar for Arvinth
Member Avatar for Arvinth
0
323
Member Avatar for chaitanya.b
Member Avatar for david31337

It is O(length), but what is the variable s? Is it a string of fixed size? Is it a variable length string? If so, then generally, your running time is O(length * s.length()), because the indexOf method should take O(s.length()) time in the average and worst case. Holding s.length() fixed, …

Member Avatar for david31337
0
125
Member Avatar for rani
Member Avatar for Cole

If you learn Java now, you'll be bored during the Java course. Learn Scheme. It's a simple language, and is very powerful (in terms of writing useful programs quickly). You'll have a different perspective on things that will make you consider Java and other object oriented languages to be languages …

Member Avatar for jwenting
0
195
Member Avatar for Virii

They're right; it's a lot of theory. You should still study computer science for what you want. (I don't know whether this recommendation comes from my honest assessment of your situation or my desire to sic theoretical classes onto unsuspecting victims.) [quote]-- Web Programming (Web Development using PHP, ASP, .NET, …

Member Avatar for Narue
0
279
Member Avatar for roryt

The End.