2,827 Posted Topics

Member Avatar for davidcraigster

All your constructors are declaring local variables which immediately go out of scope. Hence you may as well delete them. Even if they weren't going out of scope and you used the class variables, they are immediately going out of scope(can't use array index 26 - valid indexes are 0 …

Member Avatar for Ancient Dragon
0
836
Member Avatar for Kunal Aggarwal

I guess you need an algorithm to convert a tree node to an (x,y) coordinate based on the overall tree. The y is easy. That's just the depth of the node. The x is going to be harder. And what's really going to be hard is making sure everything doesn't …

Member Avatar for Kunal Aggarwal
0
152
Member Avatar for dospy

There are no hard and fast rules, but there are general guidelines. The overall theme is "give them what they need to do the job and no more than that". If they can't access it, they can't accidentally screw it up. They also don't ned to know or care about …

Member Avatar for dospy
0
195
Member Avatar for TailsTheFox

There's no "wait" command in time.h. [url]http://www.cplusplus.com/reference/clibrary/ctime/[/url] Don't know where you found this, but it must have either been a user-defined function or another library was included.

Member Avatar for VernonDozier
0
5K
Member Avatar for Naqib

[QUOTE=Naqib;1512599]Hy welcom to all. I want to controll mini remote controll car from laptop. i have only experience of java desktop application. but no experience in wireless programming. what i do to complete this project thanks[/QUOTE] You'll need a remote that can be controlled via a laptop, presumably one that …

Member Avatar for VernonDozier
0
203
Member Avatar for jmcginny5

First things first, get it to compile. Stick some return values in there, even if they're nonsense return values. Second, indent the code so it's readable. Third, find your missing brackets. That'll be much easier when you indent.

Member Avatar for jmcginny5
0
3K
Member Avatar for Menace 83

Read the rules. No homework dumps. You need to post an attempt and ask a specific question.

Member Avatar for Menace 83
-1
554
Member Avatar for margeaux54

Use sizeof: [code] #include <iostream> using namespace std; int main() { cout << "int : " << sizeof(int) << endl; cout << "char : " << sizeof(char) << endl; cout << "float : " << sizeof(float) << endl; cout << "double : " << sizeof(double) << endl; cout << "long …

Member Avatar for Fbody
0
170
Member Avatar for rp45

Seems to me that if you want to catch bad input by player 1 you need another "else if" along these lines... [code] else if (playerOne == 'P' || playerOne == 'p')[/code] And the "else" should be an "invalid input" message. Right now "else" assumes player 1 entered something valid …

Member Avatar for VernonDozier
0
94
Member Avatar for a.muqeet khan

>> how do u use it How do you use what? Don't make us play 20 questions. If you have a question about Mike's answer, state the question. We don't know what "it" refers to.

Member Avatar for VernonDozier
0
191
Member Avatar for Khoanyneosr

I don't see any char variables, so I presume you're trying to read a char into line 19, which asks for an int? The thread pinned to the top doesn't really address that issue. If you want to take characters, you'll need to read it into a string, check to …

Member Avatar for Khoanyneosr
0
158
Member Avatar for taumang

"sum" would imply adding. I see no addition operator (+) in your code. Hence no adding is done.

Member Avatar for saadsaidi
0
132
Member Avatar for gedas

Start debugging this function... [code] public int getAvrageSpeed(){ distance2 = (int) Math.sqrt(Math.pow(oldRandomX-randomX,2) + Math.pow(oldRandomY-randomY,2)); speed = (int) (distance2 / avrgTime); if((randomX <= xb && randomX+15 >= xb)&&(randomY <= yb && randomY+15 >= yb)){ avrg = (speed+avrg); avrgSpeed = avrg /zz; oldRandomX = randomX; oldRandomY =randomY; avrgTime=0.0; } return avrgSpeed; }[/code] …

Member Avatar for gedas
0
155
Member Avatar for Sc@recrow

>> Even when n is quite large, it still returns 0. How large is large? I imagine if you had a million numbers, you could probably get a timing. A thousand might be too few.

Member Avatar for rubberman
0
130
Member Avatar for Khoanyneosr

Is that the function declaration or the function call? If it's the call, get rid of the types(string, int).

Member Avatar for Khoanyneosr
0
279
Member Avatar for frogboy77

>> About your frogboy, i can tell you are a good human beings with a good soul From this thread, I judge frogboy to be a bad human being with a bad soul and Jon Karpinsky to be a good human being with a good soul. >> Far from it. …

Member Avatar for jon.kiparsky
0
269
Member Avatar for margeaux54

Sounds like you need`to do the "merge" part of a merge sort. Time to stick some debugging code in there. Lines 16 -21 added by me. Make sure the while loop functions as you think it should... [code] while ( e!=10 || f!=10); { if(array1[e].ave<array2[f].ave) { array3[g]=array1[e]; e=e+1; g=g+1; } …

Member Avatar for margeaux54
0
244
Member Avatar for DaniwebOS

>> Run the program, it just says there's syntax errors. It either runs or there are syntax errors. If there are syntax errors, it won't compile, so it can't run. There could be a RUN-TIME error, but that's not a syntax error. What's the exact error message, what's the line …

Member Avatar for VernonDozier
0
435
Member Avatar for CrumbledCookies

Just throwing something out here. Nine items in file, counter set to 10, the eof bit in the stream never being reset or checked, the file continuously being closed and reopened, and this: [quote] whereas when I type the last item number on the list, it can locate it [/quote] …

Member Avatar for CrumbledCookies
0
359
Member Avatar for Blackiey

You need a function that converts integers to a string. itoa, sprintf, or stringstreams are your best bet. itoa is non-standard, so you may have to write your own. This is C++. Stringstreams will do you just fine. This won't work... [code] board [i][j] =('0'-48)+(9*i + j+1); [/code] Too many …

Member Avatar for VernonDozier
0
918
Member Avatar for lochnessmonster

I'm unfamiliar with Windows programming, I've never seen the BYTE type, but presumably you can create a char* object containing everything and convert to a BYTE*, in which case you can use the standard cstring functions. [code] char buffer[100]; buffer[0] = 0; // not needed, but I tend to do …

Member Avatar for maybnxtseasn
0
2K
Member Avatar for biancaW

There's no way in hell I'm going to look at code with spacing like that. Get rid of the blank lines and add some indentation, etc. In addition, answer the question about whether we're dealing with anagrams or palindromes, tell us what the errors are, etc.

Member Avatar for L7Sqr
0
407
Member Avatar for ed_shaw

So this is an idea for Daniweb? YouTube? Everywhere? Seems like an easy enough thing to implement. It's one more filter on a database query ("only show records from these users"). I like the idea. Or you can do it like everyone does it now. Link it to your Facebook …

Member Avatar for VernonDozier
0
150
Member Avatar for TrustyTony

[QUOTE=tonyjv;]See the ranking of this newbie poster and compare it to statistics of the day for the site. Gives some thoughts about what kind of members the forum has. How about OpenID login without registration.[/QUOTE] I'm guessing we have an 850,000 way tie for spot 4,444. JamieLynnSEO, I just repped …

Member Avatar for Dani
0
227
Member Avatar for programing

Sort them first. 8,9,6,7,5,7,3,5,2,5,8,9 --> 2, 3, [COLOR="Red"]5, 5, 5[/COLOR], 6, 7, 7, 8, 8, 9, 9 Now that the list is sorted, you can take advantage of that fact, so there's no need for a counts[] array since you're only dealing with one number at a time and can …

Member Avatar for WaltP
0
2K
Member Avatar for LevyDee

>> From line 15, it jumps to line 30. Significantly, all the tellg and seekg's happen BETWEEN lines 15 and 30. The file isn't opening correctly in the first place. Can't see how a file size would have any effect at all here. Perhaps write a small independent program that …

Member Avatar for Kanoisa
0
148
Member Avatar for dare599z

That isn't the issue. I've added some debugging code in your loop so you can see what's going on. The displays may surprise you! [code] #include <iostream> using namespace std; int main() { int nDecimal = 0; cout << "Decilmal to Binary\nEnter the decimal value: "; cin >> nDecimal; int …

Member Avatar for dare599z
2
283
Member Avatar for Tinee

They're sorting the list from high to low, then picking the first two elements, which are, since it's a sorted list, the largest two elements. Note that they don't use the 0 array index. Arrays start with element index 0 in C++, not 1.

Member Avatar for Tinee
0
316
Member Avatar for mluu510
Member Avatar for mrnutty
0
143
Member Avatar for caut_baia

I'm not sure I buy into this idea that if one provides code, they "deprive" or "ruin" anybody's thinking process. Maybe it's because I'm older, have already "been there, done that" as far as formal schooling goes, and I'm a professional programmer now. I've already proved myself and hence no …

Member Avatar for caut_baia
0
370
Member Avatar for subith86

I'm surprised lines 3 and 12 display "a" actually. I'm wondering if it's dumb luck. I would expect the FIRST character printed to be 'a', but after that, since you have no null terminator, I'd say it's undefined behavior. Potentially you could just print stuff forever. char* is assumed to …

Member Avatar for subith86
0
322
Member Avatar for Khoanyneosr

>> it did nothing It did "nothing"? It should have at least displayed "Welcome to Word Jumble By Khoanyneosr!" Are you sure this compiled? If so, it did something. What did it do?

Member Avatar for VernonDozier
0
592
Member Avatar for destroyer89100

>> come on Too pushy. >> I must submit it after tomorrow Not our problem. >> I don't have enough time Tough. If I was going to help you before, now I won't. >> please just give me the correction of my code Again, too pushy. Note that this post …

Member Avatar for floatingDivs
-4
201
Member Avatar for shbunch

Your class wouldn't be called incrementMinutes. It would be called Time or something similar. Presumably it would have hours, minutes, and seconds as its data members, and it would have a METHOD called incrementMinutes. [code] class Time { private: int hour; int minute; int second; public: Time(int hr, int min, …

Member Avatar for VernonDozier
0
100
Member Avatar for Marcial

[code] volume=[COLOR="Red"](4/3)[/COLOR]*pi*pow(radius,3); [/code] Integer division. 4 / 3 is 1, not 1.333. Try replacing with floating point to avoid this problem. [code] volume=(4.0/3.0)*pi*pow(radius,3);[/code]

Member Avatar for VernonDozier
0
155
Member Avatar for Alex Edwards

5 + 3 * 8 - 4 = 25 This is correct. 5 + 3 * 8 - 4 = 5 + (3 * 8) - 4 = 5 + 24 - 4 = (5 + 24) - 4 = 29 - 4 = 25. 12 / 3 * 4 …

Member Avatar for Taywin
1
3K
Member Avatar for hous3aholik

Just use an infinite loop. You already have the exit statement in there for when they quit, so you don't need a condition for the while statement. [code] while(true) { // stick everything that needs to repeated here }[/code]

Member Avatar for VernonDozier
0
2K
Member Avatar for WildBamaBoy

It's one of those things where you have to learn the mechanics of pointers first, then later you'll understand the wisdom. One always starts from easy to hard and the easy examples are almost always examples where you could just as easily do without them, so they don't make much …

Member Avatar for WildBamaBoy
0
172
Member Avatar for imhiya

Not sure what the question is. If it's "How do I set up/add to a colection if I don't know the size?", you've already answered yourself: >> I thought i could search if it's already in the array/[COLOR="Red"]vector[/COLOR]. >> so i would have to include a [COLOR="Red"]expanding varible[/COLOR]. Vectors are …

Member Avatar for VernonDozier
0
155
Member Avatar for MasterGberry

>> So i am assuming they are built into the EXE I doubt it. I've never heard of such a thing. An executable is just machine code, isn't it?

Member Avatar for VernonDozier
0
182
Member Avatar for AutoPython

Since it's already defined, you already have it, sort of. Just leave the keyword "string" out as well the inner brackets. [code] for (int x=1; x<3; x++) {MyArray[1][x]="-";} [/code] This is a 2-D string array? [EDIT] Actually, I think you have to fill in the "blah", "etcetera", and the declaration …

Member Avatar for AutoPython
0
116
Member Avatar for chess2009

I'd say that once someone posts something here, no one owns it anymore, or everyone owns it. You can't really say Daniweb owns them, because then I'd need to get Daniweb's permission to use my own code that I posted, which I clearly don't need. And anyone who decided to …

Member Avatar for Ezzaral
0
367
Member Avatar for gnyderek

[QUOTE=gnyderek;]it's a very simple program: payroll calculations for 5 employees. but how to do the count?[/QUOTE] How the hell should we know?

Member Avatar for Stefano Mtangoo
-1
84
Member Avatar for Sherry.K

[QUOTE=Taywin;]??? I don't see any equation like that above? Also, the value of 'money' would go sky rocket in one go ???[/QUOTE] Just ignore that post completely. It's ridiculous on so many levels. Then again, the OP deserves no better. With any luck, the OP will submit that line of …

Member Avatar for VernonDozier
-4
599
Member Avatar for Michael_Knight

If the Army had wanted you to have an opinion, it would have issued you one. - Every drill instructor who has ever lived.

Member Avatar for happygeek
0
1K
Member Avatar for margeaux54

I suggest removing all cin and cout statements from encrypt and decrypt. Those functions should be used to encrypt and decrypt. It should be other functions' job to provide encrypt and decrypt with data and decide what to do with it. Perhaps I would like to use your decrypt and …

Member Avatar for margeaux54
0
189
Member Avatar for CanaznFTW

itoa isn't standard. I don't know why. But since it isn't standard, some compilers will have it, some won't. You can either find a compiler that has it, write your own, or use a standard function like sprintf. I suggest going with options 2 or 3.

Member Avatar for CanaznFTW
0
408
Member Avatar for dspjm

cplusplus.com gives good descriptions of what each function does. exit "cleans up" upon exiting. abort doesn't. Good discussion here. [url]http://stackoverflow.com/questions/397075/what-is-the-difference-between-exit-and-abort[/url]

Member Avatar for dspjm
0
1K
Member Avatar for Karkalash

[code] vector<[COLOR="Red"]Term[/COLOR]> term; [/code] [code] [COLOR="Red"]string[/COLOR] userWord; myDictionary.term.push_back(userWord); [/code] See red. These need to match. You have a vector of Term. Push a Term, not a string. Try this. [code] Term aTerm; aTerm.word = userWord; aTerm.definition = userDefinition; myDictionary.term.push_back(aTerm);[/code] Now all the types match and the compiler should be happy.

Member Avatar for VernonDozier
0
222
Member Avatar for johans22

Things would go much much faster if the data was stored purely as binary data (i.e. the raw bytes) rather than as a text file. The tabs also screw everything up. If it was the bytes themselves, you'd just use fread from cstdio and read thousands of bytes at a …

Member Avatar for VernonDozier
0
76

The End.