Before you push_back the word, I think you can just test if it is a new line like this:
if(word == "\n")
continue;
Let me know if that does what you're looking for.
Thanks,
Dave
Before you push_back the word, I think you can just test if it is a new line like this:
if(word == "\n")
continue;
Let me know if that does what you're looking for.
Thanks,
Dave
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 "reactiviated"?
Dave
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
I would refrain from storing a pointer to a vector of pointers if possible. If this is a small application, I don't see a reason not to just store the data like this:
vector<SPELL> castableSpells;
That will certainly make things much much easier.
Dave
VernonDozier, am I crazy or are those two code snippets identical?
Dave
Certainly you can pare this down to < 20 lines or so with a main function that will show us the problem.
Dave
cin>>float scale;
is not valid syntax. Try simply cin>> scale;
instead.
There are a few problems.
1)
You must
#include <cstring>
in player.cpp to use strlen
2) you have not given us main.cpp
3) You have declared wait() in globals.h, but not implemented it anywhere.
Once you fix those we can start to look at the multiple definition of 'player'. Multiple definition simply means that you have defined a variable named 'player' somewhere, then somewhere else in the same scope, you have tried to name something else 'player'.
Good luck,
Dave
You have to select "1" before you can select "2" and start adding elements - else the vector is not defined! I'd suggest getting rid of all of the cod that is not necessary, setting the inputs you can in the code, and posting the shortest compilable example of what is going wrong.
Dave
'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
How is 'it' defined? Please provide compilable code that produces the problem so we can take a look.
Dave
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
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
Please use code tags. It significantly improves readability (and hence likelihood of a reply :) )
Please provide the shortest compilable example code, sample input, current output, and expected output.
Dave
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 timer:
http://www.libsdl.org/intro.en/usingtimers.html
Some other recommended reading:
http://daviddoria.blogspot.com/2010/05/problem-abstraction-helping-others-help.html
Good luck,
Dave
So it works now? If so great, please mark the thread as solved.
Dave
The function is defined in a namespace:
namespace scythe {
/*! @cond */
/* Forward declarations */
double gammafn (double);
So you have to call it like this:
double k=scythe::gammafn(5.0);
It seems completely crazy to me that they do not include any examples!!
Good luck.
Dave
Did you do what I said to check which file was being written? Also, show us the declaration of the ofstreams. In fact, why don't you make a < 20 line example that demonstrates the problem.
Dave
Well to make an adjacency matrix, you'll definitely need a matrix! You could use a 2D array: http://www.fredosaurus.com/notes-cpp/arrayptr/22twodim.html. The problem with this is that you'll have to know the size of the matrix before you start, which is not always the case.
Dave
Here are a handful of explanations and possible solutions:
http://www.daniweb.com/forums/thread114299.html
You'll have to show us the printToFile function.
I also recommend
if ( c >= 12)
{
x[i].printToFile(outFile1);
std::cout << "File1" << std::endl;
}
else
{
x[i].printToFile(outFile2);
std::cout << "File2" << std::endl;
}
to make sure the conditional is triggered correctly.
Dave
Do you have a matrix class? If not, I'd recommend vnl_matrix from VNL (part of VXL). You can then just do:
yourMatrix(r1,c1) = float1
Dave
vijayan121, thanks for the link. Although I see how it could be considered biased (haha), I agree with him completely on all of the points about teaching programming.
Dave
You're really going to have to narrow down the problem/make it much more explicit.
Some recommended reading:
http://daviddoria.blogspot.com/2010/05/problem-abstraction-helping-others-help.html
Dave
If you put this code in the form Paint event instead of form Load, the desired effect is achieved.
Thanks for your help.
Dave
Ah, great, that is exactly what I was looking for. Why doesn't it work if run in form_load?
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.
Hm, I made an empty project and put that code in form load (and removed the "if" for the check box). When I run it, the form is empty. Shouldn't I expect to see "sample text" on the form?
Thanks,
Dave
finito - I actually have a reasonable computer (IBM T43P) and nothing else is running.
adatapost - so what do people do in this situation? Just have an incorrect timer?? That doesn't seem too reasonable.
Dave
I have some white text I am putting over a very light background. Is there anyway to outline the text in black? After some googling it looks like there are some pretty complicated solutions, but I am looking for something like a check box that says "outline". Is there such a beast?
Thanks,
Dave
I set the .Interval of a timer to "10", which I believe means 10 milliseconds. Since there are 1000 ms in 1 second, if I count to 100, I should have 1 second, right? The problem is, if I use a physical stop watch and compare it to my program, it is about 2x slower than the real time. Has anyone else experienced this?
Thanks,
Dave
You had me confused for a minute, but you have a classic mistake! Remove the semicolon at the end of the for statement:
i.e. change this
for (int count =0; count <= numberGrades; count++);
to this:
for (int count =0; count <= numberGrades; count++)
Dave
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
I imagine the problem is how you are actually compiling it. You need to compile both countertest.cpp as well as counter.cpp. My guess is that you are only compiling countertest.cpp.
Dave
Please be more clear. How have you defined str? Did you #include <string> ? Did you use std::string? What do you mean by "not working"?
Yes yes sorry, I've already been yelled at :) I got carried away with the "unanswered threads" button. I thought there may have been people out there that were frustrated with their threads going unanswered. What I forgot, though, is that the threads were also being bumped, not just replied to, pushing down more recent/important things.
I'm now on my best behavior - sorry for the noise.
Dave
Read in the file, then search the text in c++?
I'd suggest using a library for image processing such as VTK, OpenCV, or VIL (part of VXL).
Dave
What is the problem?
What did you try?
Yes, I understood the problem - did you look up delimiters and string parsing?
First, please use real English words (i.e. not "dis"). Second, I would keep track of the number in a separate counter that is incremented manually in the inner loop rather than trying to increment j and m in the loop definition. Give that a try and see if it helps.
Dave
Well the first major problem is that you are not passing the variables by reference to GetScore, so they aren't going to be available when you leave it!
I'd look into cin and std::string. Also, multiply is * in c++ :)
Here's the deal - I'll spend as much time helping you as you have spent trying yourself! Ok, I'm done!
What have you tried? Lookup "delimiters". Also, unless I'm mistaken, Turbo c++ and Dev c++ are simple IDEs, not languages, right?
Dave
vtkPNGReader is able to read alpha values:
Maybe it would be different with DaniWeb, but a VERY few people in the community where I started the examples wiki actually decided to contribute. It was therefore very easy for me to monitor using the "watch" feature on all of the pages of the wiki. When anything is changed/added I got an email. If it was low quality, I talked to the person and helped them straighten it out. If it was spam, it was deleted and the account blocked.
If everyone agrees that it is a good idea but is afraid of the warnings that S.O.S provided, I don't think it would be too much work to setup and give it a "trial period". I'd be happy to add an initial 50 simple examples and then keep a watchful eye on it.
Hi Dani et al.,
I don't know if you'll have any interest in this, but I'm going to describe what I have done over the past couple of years on an open source project that I think could be extremely beneficial to Daniweb as well.
The project I work on (VTK - the Visualization Toolkit) has a very active user mailing list. After following the list for a few months, I realize the same questions were being asked over and over again. Each time a question was asked, someone would spend a non trivial amount of time answering the question that had already been answered! I started a wiki page dedicated to posting the solutions to common problems and techniques:
http://www.vtk.org/Wiki/VTK/Examples
After a lot of effort compiling this, almost every question can now be answered in a single line reply - a link to one of these wiki examples. When a question has not been seen before, it is my (or someone elses) job to get it into a standalone/compilable example and make a new wiki page for it.
This system has seemed to help us TREMENDOUSLY. Not only does it take a lot of effort out of answering the mailing list, it also is an excellent resource for new users to "self learn" our toolkit.
I am a follower of the c++ section of your site. I realize that while VTK only took about 500, c++ may take take (just a …