2,827 Posted Topics

Member Avatar for bensewards

>> my advice, dont use a recursive function where a loop would suffice You wouldn't write these functions recursively in real life, but as a learning exercise for learning recursion, it's a good exercise. I'm wondering if there will be a follow-up exercise where the OP writes them recursively and …

Member Avatar for bensewards
0
758
Member Avatar for daviddoria

A quick look at the preprocessor article on Wikipedia seems to hold the key. [url]http://en.wikipedia.org/wiki/C_preprocessor[/url] Relevant lines... [code] The following are the first four (of eight) phases of translation specified in the C Standard: Trigraph replacement — The preprocessor replaces trigraph sequences with the characters they represent. Line splicing — …

Member Avatar for daviddoria
0
135
Member Avatar for goyofoyo

Before coding, you need to decide what a "collision" is. Generally a "collision" would be the two objects having the same coordinates at the same time. From a Venn Diagram point of view, if you draw A and B on a piece of paper, A and B collide if they …

Member Avatar for VernonDozier
0
402
Member Avatar for jingda

>> But what topic do i have to look out for How could anyone but you possibly know? Normally the teacher tells you what the exam is on. We don't even know what courses you are taking. I guess you're studying biology, so take note of DNA and cells. But …

Member Avatar for diafol
-2
135
Member Avatar for zychos

Line 13. Is keytab a TYPE or is keytab the name of a variable? You seem to want to use it as both. I imagine you want something like this: [code] keytab keytabs[NKEYS] = {/* initialization */};[/code]

Member Avatar for zychos
0
463
Member Avatar for SMITA6076

>> why am I doing this in an IDE? Perhaps that's the ANSWER rather than the question. Question : Why are you making variables public? Answer : Because IDEs like NetBeans seem to find public variables and they don't find private ones (you know, when you type in the variable …

Member Avatar for VernonDozier
0
332
Member Avatar for VernonDozier

This link's been making the rounds. Somebody decided that to be well-rounded you should have both brains and brawn, so there's a new sport and it's 100% real. You box for 3 minutes, then play chess for 3 minutes, then box for 3 minutes, then play chess for 3 minutes... …

Member Avatar for BitBlt
0
183
Member Avatar for Awilson089

>> its an odd number? And the reasoning behind this guess is...? If you can't fill in the dots, withdraw the guess.

Member Avatar for VernonDozier
0
254
Member Avatar for yongj

Advice on how to implement the functions would be counter-productive if you're at the "complete blank" stage. You can't implement anything if you don't know what each function needs to do, which means sticking comments above each function describing what it does, what parameters it needs, and what it returns. …

Member Avatar for VernonDozier
0
137
Member Avatar for mpike

If you can't pause the program, perhaps you can spawn a child process and have THAT sleep. Or a thread. But I doubt the real solution is to sleep. The real problem, I would imagine, is that it subtracts more than once for a collision, so change it so it …

Member Avatar for VernonDozier
0
126
Member Avatar for hous3aholik

Well if you have five numbers to store, might as well make an array and store them in the array. [code] int random_integer[5]; [/code] Now fill in the array. Once you have that, you'll need some way of converting 5 numbers to a string. [code] string toString(int array[], const int …

Member Avatar for TrustyTony
0
2K
Member Avatar for DaniwebOS

I'm failing to see the point of lines 72 and 73. Perhaps there should be a "this" in there somewhere? That would solve line 73's problem, but not line 72. I'm looking in vain on line 67 for a variable called "bio".

Member Avatar for DaniwebOS
0
21K
Member Avatar for hous3aholik

Line 27 - Shouldn't you be checking "found" to help decide what you need to return? What should you return if "found" is false? Is that what you are indeed returning?

Member Avatar for VernonDozier
0
195
Member Avatar for cossay
Member Avatar for Tomi1988
0
145
Member Avatar for manofhouse

Point out the changes you've made so we don't have to scan the code. >> the output aborts itself for some reason The process can either run to completion and exit with return code 0 (whether you intended it to or not) or you can get a premature termination due …

Member Avatar for Tomi1988
0
421
Member Avatar for Armanious

It does sound inefficient. If I'm typing in the entire text of Huck Finn and my keywords are "Huck" and "Jim" and I'm already on page 200 and I press a key, it doesn't make sense to parse 200 pages of text that I've already parsed (let's see 80 characters …

Member Avatar for VernonDozier
0
153
Member Avatar for kodera

>> I have intiialized No, you have not, unless there's new code. I'm search for something that looks like "key = new char[...]" and not seeing it.

Member Avatar for kodera
0
111
Member Avatar for guccitan88

[code] for (int column = 0; column < sales[row].length; column++) { sales[row][2] = sales[row][2] + 500.00 ; System.out.print(sales[row][column] + " ") ; } [/code] Let row = 0. I'm seeing sales[0][2] changing multiple times, 4 to be exact. I doubt you're doing that on purpose.

Member Avatar for guccitan88
0
131
Member Avatar for mas51

Program 1 has a bad compare function. See if you can spot the problem. [code] int AbstractSort:: compare(int x, int y) //compare func { comparisonCount++; return x -x; } [/code] Program 2 doesn't appear to USE its compare function, so whether it's right or wrong is irrelevant.

Member Avatar for mas51
0
409
Member Avatar for fadi_1234

[QUOTE=jackmaverick1;]but then where are people seeing getting these bits of advice from???[/QUOTE] There's no code and there's no advice. Hence Walt P's sarcastic "psychic" comment. Even if someone wanted to help the OP, it would be impossible. The OP is either just screwing around and doesn't even want help or …

Member Avatar for VernonDozier
0
337
Member Avatar for Wrai

Never heard of the jpb package or the DrawableFrame class. Did a quick google and found this link. [url]http://knking.com/books/java/jpb/index.html[/url] Is that it? I see it extends Frame. What you describe sounds like it results from a lack of a call to a component's "super" paintComponent method. It's pretty common. Here's …

Member Avatar for Wrai
0
1K
Member Avatar for jingda

I've seen quite a few forums where you're required to post an "About Me" introduction in the introduction section before you can post anywhere else. It's all one big long thread. One post each, no responses, and your intro is linked to your profile for very quick reference. It's not …

Member Avatar for jingda
0
198
Member Avatar for spencer.kindt

The only transdate I see is a static variable in the Transaction class. Note that you haven't specified public, private, protected, so it'll default to whatever the default is, I can't remember, but you can always provide one(private, protected, public). Anyway, it's static, so you have to provide the class: …

Member Avatar for VernonDozier
0
135
Member Avatar for codeyy

I would imagine that the pop() function would be one of the last if not THE last function you'd write. You can't write it without writing top() first. getNumElements() would presumably be written first, followed by isEmpty(), isFull(), and push(), followed by top(). When all that's written and works, you …

Member Avatar for Narue
0
165
Member Avatar for C++NewBe

Stick some variable names here. The compiler doesn't care, but anyone reading it trying to decide what parameter goes with what needs to know, particularly for your question. [code] void tempAvg (double [][MaxTimes], int, int); [/code] This doesn't match the above. Which one are we checking? [code] void tempAvg (double …

Member Avatar for VernonDozier
0
136
Member Avatar for tc121091

Rule 1 for readability. Pick some good variable names and throw in some comments. Rule 2 for readability. When you ask the user to enter in information, tell them what you want them to do. All I get is a cursor waiting for me to...who knows? Tell me! [code] scanf("%d",&n); …

Member Avatar for VernonDozier
-1
89
Member Avatar for Bastiondar

>> "...something in the loop body must cause the expression to become false at some time. One of the things you do not do ever, is write an if statement to change the loop control variable to make the condition false." Not sure who you're quoting, but I don't see …

Member Avatar for Bastiondar
0
352
Member Avatar for dyingatmidnight

Line 33 looks problematic on the second insert. I see tail being assigned to 0 earlier, but I see nowhere where you assign tail to be anything other than 0, so on line 33 you would be dereferencing a null pointer. Can't do that. Seems to me that on your …

Member Avatar for mike_2000_17
0
237
Member Avatar for TheSassyDragon

This shouldn't compile (and it doesn't for me). x is out of scope on line 9. What is "less than" something else? Is {5,3} less than {3,4}? Or vice-versa? I don't know what the default "less than" is, for one array being "less than" another, but you can't sort unless …

Member Avatar for TheSassyDragon
0
156
Member Avatar for caltech

[QUOTE=caltech;1527532]Professor said the same thing as you guys, when he ran it it ran as it was supposed to... He thinks it's my filepath? But it's opening the file. Could it be my compiler? What could I do about the filepath? Unless I reference it from the root /User all …

Member Avatar for VernonDozier
-7
248
Member Avatar for dyingatmidnight

2-D array constructor... [code] table = new int*[size]; for(int i = 0; i < size; i++) { table[i] = new int[size]; } [/code] 2-D destructor... [code] for(int i = 0; i < size; i++) { delete table[i]; } delete table; [/code] Keep in mind that you CANNOT assume that all …

Member Avatar for dyingatmidnight
0
331
Member Avatar for mrnutty

>> Thanks guys. I'm actually not gonna flip a coin. I'm going to weigh the pro's and con's between the two. As far as dilemmas go, having to pick between two jobs/internships is a good dilemma to have. Good luck.

Member Avatar for jingda
0
236
Member Avatar for Mkmd13

One, what's the question? Two, what's the point of the loop fro 25 - 28? Just pick one random number number from 0 to 49 and use that as the index. The array declared on line 9 seems pointless. You're reading in 50 Strings from the file and picking one …

Member Avatar for VernonDozier
0
183
Member Avatar for Mizki

One, if you are looking for odd numbers only, check whether sIndex is odd first thing. If not, make it odd by adding one to it. Two, to avoid overflow, you should probably test whether sIndex >= eIndex rather than == eIndex. Three, also to avoid overflow and other errors, …

Member Avatar for Mizki
0
3K
Member Avatar for Loki55

>> Another question!!! How do I get this program to print ei when you input e. Apparently I have to figure out how to mess up my program. Before getting too involved, you perhaps should explain what you're doing and why. I can think of a whole bunch of ways …

Member Avatar for WaltP
0
117
Member Avatar for mrgreen

[quote] I am reading in a set of 10 numbers from a file into an array, then printing the array out using recursion, then I have to take the summation of 1-last number in the array (Ex 1-14). The problem is that my function currently sums all of the elements …

Member Avatar for mrgreen
0
125
Member Avatar for frogboy77

>> I refer to those threads as an ambush (I really do). I never thought about it in that term, but damn, you're right. It's manipulative and hostile, isn't it? >> You get someone posting code missing a semicolon, you tell them how to fix it, and they're sometimes like …

Member Avatar for jonsca
0
123
Member Avatar for finchh

>> Thanks in advance! Don't thank us. We aren't going to do this for you. Read the rules. You have to show you are willing to put in some effort. Only post here when you get stuck.

Member Avatar for Ancient Dragon
0
165
Member Avatar for inzombiak

>> At first i though the problem was that t2 and r were both int,but even when i just write "Km = 16/21" it gives me Km = 0. You've hit the nail on the head I think. That's the problem. 16 / 21 is 0. How can it be …

Member Avatar for VernonDozier
0
106
Member Avatar for Taimoor Rana

Ezzaral mentioned the infinite loop (why bother CHECKING for changes when you know EXACTLY WHEN things change (i.e. when the timer goes off. Display a printout or update the JTextField only when the time CHANGES). The constant checking and printing hogs a lot of resources. That may not have adverse …

Member Avatar for Taimoor Rana
0
846
Member Avatar for debasisdas

Consider the source. Your comment was completely on the mark and justified and you got down-voted precisely BECAUSE it was completely on the mark and justified. Upvoted from me as a counterbalance.

Member Avatar for VernonDozier
0
203
Member Avatar for manofhouse

I'm the compiler. I know what you want me to do if that big long condition is false. But what shall I do if it's true? You need to tell me. That's the error. Side note: Take a look at the xdigit function. It'll save you a lot of Logical …

Member Avatar for WaltP
0
467
Member Avatar for Taimoor Rana

>> but for some reason its not working Define "working". What's it doing that you don't want it to do or vice versa? It looks like it'll keep fine time. You'll get twenty zillion 0's then twenty zillion 1's, then twenty zillion 2's, etc. I imagine you want to have …

Member Avatar for Taimoor Rana
0
1K
Member Avatar for manofhouse

The compiler can't figure out what you are trying to do (nor can I), so it's throwing up its hands and giving up and throwing an error. You have three options when declaring a variable (there may be more I am thinking of)... [code] std::string hexNumber; std::string hexNumber(/* some expression …

Member Avatar for VernonDozier
0
416
Member Avatar for JetsFan

>> Computers are at best my third preferred career path. >> as far as I'm concerned programming for hours at a time is one of the things one encounters in hell. You've answered your own question. Why would you pick your third preferred career path instead of your first or …

Member Avatar for zekish
0
204
Member Avatar for ChaseRLewis

- Teach Java over two semesters second semester specializing in more complex subjects and networking. I'll vote a definite no to the "specializing in more complex subjects and networking" in a second semester high school class. You might consider it in an elite magnet school like Lowell High School in …

Member Avatar for VernonDozier
0
137
Member Avatar for happygeek

Ditto Narue and Jon. One million members is a bad thing, not a good thing. As a side, but related note, I just got an e-mail from Dream in Code very similar to what Dani posted. Apparently they got hit by the same Google update. Relevant sections in red. If …

Member Avatar for TrustyTony
0
477
Member Avatar for Doughnuts

>> memory leak? That's what you have to figure out. "Crash" is too vague. Bad memory management generally fall into a few categories... [LIST=1] [*]You run out of memory. That means you keep allocating and never delete memory and eventually can't allocate. [*]Deleting memory where you shouldn't, then trying to …

Member Avatar for Ancient Dragon
0
169
Member Avatar for arun srinivaas

From cplusplus.com [code] // operator new example #include <iostream> #include <new> using namespace std; struct myclass {myclass() {cout <<"myclass constructed\n";}}; int main () { int * p1 = new int; // same as: // int * p1 = (int*) operator new (sizeof(int)); int * p2 = new (nothrow) int; // …

Member Avatar for rubberman
0
212
Member Avatar for terexberd

If you're looking for a program that's already written that does this, you're probably in the wrong forum. This is the C++ forum. Such a program may exist. Whether it's legal or publicly available for purchase I don't know. If you're looking to WRITE it, that's a different story.

Member Avatar for VernonDozier
0
213

The End.