1,177 Posted Topics

Member Avatar for rowley4

I think what you are trying to do is convert a non-string to a string representation, yes? If so, look into std::stringstream. You can simply do: [code] std::stringstream ss; ss << yourThing; std::string >> ss; [/code] Dave

Member Avatar for daviddoria
0
136
Member Avatar for daviddoria

I've seen a few posts on here talking about "databases" as if they were just files and using fstream to manipulate the file pointer, etc. I'm familiar with SQL, so it would be nice to simply be able to execute sql command (as can be done from vb.net) such as: …

Member Avatar for tesuji
0
235
Member Avatar for dimios

I'd say 'a' is the most important. 'b' is really part of 'a'. 'c' is probably referring to the functions in <algorithm>, which C certainly does not have. 'd' is correct, void pointers and preprocessor directives are nightmares! Dave

Member Avatar for NathanOliver
0
215
Member Avatar for eng hassan

One thing I see is that you are not checking the bounds of the movement - i.e. [code] void movedown(int x, int y) { x = x; y = y + 1; }; [/code] Should be something like: [code] void movedown(int x, int y) { // x = x; //this …

Member Avatar for eng hassan
0
116
Member Avatar for Ryan61343

There are a couple of non-exhaustive search ideas here: [url]http://www.experts-exchange.com/Programming/Algorithms/Q_23060580.html[/url] They seem to be based mainly on two facts: 1) the board fills from the bottom, so there should be many solutions involving the top of the board that are not possible and 2) for the rows, if you haven't …

Member Avatar for Ryan61343
0
92
Member Avatar for Talguy

I only have an answer to the first question. I ALWAYS reference member variables with [icode]this->[/icode]. I've found that it makes code much much more readable. If you have a long function, reader immediately know that this is a member variable and don't have to spend time looking around to …

Member Avatar for Aranarth
0
116
Member Avatar for waleed-707

Why is Bugarr defined in that header? If it is not part of the class (which it is not, it is a global variable), then it should probably not belong in the class's header.

Member Avatar for waleed-707
0
4K
Member Avatar for iamcreasy

Please post 'character.h'. I suspect something like this: [code] void Character::Character(); [/code] when it should be simply: [code] Character::Character(); [/code] Dave

Member Avatar for iamcreasy
0
161
Member Avatar for robski
Member Avatar for robski
0
115
Member Avatar for Obsidian_496

I think the whole thing should be wrapped in a class called Tree or something. Then Root is simply a member variable and can be accessed no problem from all of its member functions (which should be all of the function you have written). Let us know if you have …

Member Avatar for Obsidian_496
0
100
Member Avatar for m.naveen

jwenting - You are exactly right about employers needing to start from scratch. However, this doesn't seem like any inherent problem, it is just a bad (read "old") educational system! I write (read "whine") about this every once in a while - SNIP Dave

Member Avatar for jwenting
0
123
Member Avatar for jen5376

In recursion you need a "base case". Here I guess the base case is the first line of the song. So your function should probably be called PrintAllPreviousVerses(int verse) and just call it recursively decrementing 'verse' by 1. This actually doesn't seem like an ideal case to teach recursion, but …

Member Avatar for jen5376
0
150
Member Avatar for igorg95

1) Please wrap your code in code tags 2) Use std::string instead of char (you'll have to #include <string>) and everything should turn out much better for you :) Dave

Member Avatar for corby
0
251
Member Avatar for Ayaat Monem

This is called "ascii art". You should use a 2D array if the number of rows and columns is fixed. "Pointers" aren't a solution to a problem, but rather one of many tools c++ offers. If you have specific questions let us know. Dave

Member Avatar for daviddoria
0
73
Member Avatar for daviddoria

(I posted this in the "Geeks Lounge" but didn't get any responses - maybe there'll be better luck here?) Hi all, I was wondering if anyone one could point me to (if they exist) some places to nominate people for enormous contributions to open source and open source philosophy? There …

Member Avatar for popin
0
405
Member Avatar for daviddoria

I'm not convinced it isn't just something wrong with my installation, but has anyone else had this problem? Here is a screenshot of daniweb.com in Google Chrome on Fedora 13: [url]http://rpi.edu/~doriad/Daniweb/chrome.png[/url] And here it is (normal) in firefox: [url]http://rpi.edu/~doriad/Daniweb/firefox.png[/url] Are there any known issues like this? Or can someone else …

Member Avatar for daviddoria
0
156
Member Avatar for dnk77
Member Avatar for Nick Evan
0
75
Member Avatar for new2programming

Did you try a simpler program (still using SDL)? Try to get a < 20 line program where the timer doesn't work. Dave

Member Avatar for daviddoria
0
241
Member Avatar for vinsbg

Please try to get the problem to occur not in 350 lines, but instead something manageable like 20 lines. Dave

Member Avatar for vinsbg
0
121
Member Avatar for avarionist

You are not resetting x to number.top after the stack is modified. So what is happening is you are setting x to 28, then in the loop you are modifying the stack but simply outputting 28 over and over! You need to add a [icode]x=number.top()[/icode] between the number.pop() and the …

Member Avatar for avarionist
0
114
Member Avatar for debugger09

I think you need an asynchronous timer as you will need to continue entering numbers while keeping track of the time. Boost has one: [url]http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/tutorial/tuttimer2.html[/url]

Member Avatar for debugger09
0
153
Member Avatar for Theanonymous

You're going to have to try it yourself first! Give it your best shot and let us know if you run into any particular questions. Dave

Member Avatar for Theanonymous
0
133
Member Avatar for mrnutty

Should this be posted under code snippets or something? There's not really a question is there? Dave

Member Avatar for NathanOliver
2
168
Member Avatar for drt_t1gg3r

Certainly you can pare this down to < 20 lines or so with a main function that will show us the problem. Dave

Member Avatar for ifezuec
0
211
Member Avatar for daviddoria

Is there a way to edit a post? I think there used to be, right? I don't see an edit button anymore :(

Member Avatar for Biker920
0
106
Member Avatar for Prota

Please provide the shortest compilable example code, sample input, current output, and expected output. Dave

Member Avatar for Prota
0
110
Member Avatar for ferenczi

Here is the algorithm - it is actually quite short and straight forward: [url]http://en.wikipedia.org/wiki/Breadth-first_search#Algorithm_.28informal.29[/url]

Member Avatar for daviddoria
0
376
Member Avatar for Bukhari1986

What have you tried? Lookup "delimiters". Also, unless I'm mistaken, Turbo c++ and Dev c++ are simple IDEs, not languages, right? Dave

Member Avatar for Bukhari1986
-2
136
Member Avatar for SacredFootball

Narue is right, but if you do want to use a vector for some reason, std::vector has a find() function that does exactly what you're looking for. Here is the example I have: [code] void TestFind() { std::vector<unsigned int> V(10); for(unsigned int i = 0; i < 10; i++) { …

Member Avatar for Narue
0
2K
Member Avatar for daviddoria

I applied for the "Dinner with Dani" a while ago but haven't heard anything else. I also didn't see any mention of when things would be finalized etc. Is the status "wait patiently"? Or did I miss something? Thanks, Dave

Member Avatar for Dani
0
143
Member Avatar for bobbyg118

Looks like you need to increment gradeCount[0] as you've done for 'A', but gradeCount[1] for 'B' etc, rather than gradeCount[0] each time. Dave

Member Avatar for mlesniak
0
104
Member Avatar for Suarli
Member Avatar for new2programming

I don't understand? It looks like you have working timer code - so just put it wherever you want the timer to happen in the real program, right? Dave

Member Avatar for new2programming
0
217
Member Avatar for aaronmk2

What is the error? Why don't you put a statement to check the length in all of the queue addition/removal functions. This should help you track down the problem. Also, why did you post this twice? Dave

Member Avatar for NathanOliver
0
87
Member Avatar for daviddoria

I'm having a bit of trouble with dynamic_casting. I need to determine at runtime the type of an object. Here is a demo: [code] #include <iostream> #include <string> class PersonClass { public: std::string Name; virtual void test(){}; //it is annoying that this has to be here... }; class LawyerClass : …

Member Avatar for daviddoria
0
71
Member Avatar for Osas106

I don't know about the "Chinese" characters, but it should be reasonably easy to fix the message box program. What I would suggest is making a < 20 line (or as small as possible) program that simply tries to display a message box. That should be easily debug-able by someone …

Member Avatar for Ketsuekiame
0
130
Member Avatar for rowley4

Here is an example of how to use strncpy: [url]http://www.cplusplus.com/reference/clibrary/cstring/strncpy/[/url] I strongly suggest that you try little < 10 line demonstration programs, ensure you know how everything works, and THEN write a 300 line program. It will work out much better for you, I am sure. It will also help …

Member Avatar for daviddoria
0
125
Member Avatar for gregarion

Before you push_back the word, I think you can just test if it is a new line like this: [code] if(word == "\n") continue; [/code] Let me know if that does what you're looking for. Thanks, Dave

Member Avatar for NathanOliver
0
95
Member Avatar for vb5prgrmr

Should these "one time" posters be deleted to get a true idea of the number of users? Or is the 1M user mark something to brag about :) ? Maybe they can be "deleted" in a way that if they come back wondering where their account went it could be …

Member Avatar for colweb
4
184
Member Avatar for Alex_

How is 'it' defined? Please provide compilable code that produces the problem so we can take a look. Dave

Member Avatar for Alex_
0
1K
Member Avatar for XerX

No one is going to your homework for you! Can someone put a sticky next to the "Read This Before Posting" sticky that explains not to post homework questions like this!? Dave

Member Avatar for Swiftle
-2
139
Member Avatar for d4n1x

'm' seems to be expecting to map a string to a map<string,string>, but you are trying to tell it to map a string to a string. "Problem is iterator inner" - can you be a lot more specific? Is there a compiler error? Dave

Member Avatar for d4n1x
0
114
Member Avatar for frispee

[icode]cin>>float scale;[/icode] is not valid syntax. Try simply [icode]cin>> scale;[/icode] instead.

Member Avatar for daviddoria
0
158
Member Avatar for colmcy1

You'll have to show us the values of all of the variables you are outputting. One of them must have a new line character. If you can produce a compilable example that writes the 2 line file, we'd be happy to check it out. Dave

Member Avatar for colmcy1
0
81
Member Avatar for dimios

Surely you can find (b) on any stl tutorial. I'm sure (a) is there, too. If you provide your draft of an answer, we can verify that it seems reasonable.

Member Avatar for bandtank
0
221
Member Avatar for little_grim
Member Avatar for new2programming

This is entirely too generic of a question. Please give it a try and let us know if you have specific questions. If you've already written a game, surely is won't be hard for you! If you're using a library like SDL or something already, they will surely have a …

Member Avatar for mrnutty
0
111
Member Avatar for jimJohnson

Please use code tags. It significantly improves readability (and hence likelihood of a reply :) )

Member Avatar for jimJohnson
0
81
Member Avatar for Sandhya212

The function is defined in a namespace: [code] namespace scythe { /*! @cond */ /* Forward declarations */ double gammafn (double); [/code] So you have to call it like this: [code] double k=scythe::gammafn(5.0); [/code] It seems completely crazy to me that they do not include any examples!! Good luck. Dave

Member Avatar for Sandhya212
0
162
Member Avatar for darelet

The End.