1,426 Posted Topics
Re: Show the code you have now and we should be able to help you modify it. | |
Re: Line 270: `virtual ~Deck():` Notice anything wrong with that? | |
Re: So what exactly do you need help with? Just posting your problem statement and hoping someone will give you code isn't going to work here. | |
Re: You can use [file streams](http://www.cplusplus.com/doc/tutorial/files/). | |
Re: I personally wouldn't use C++ for .Net programing. I would and have used C#. | |
Re: It is possible to do but depending on how big your project is you might not want to do it that way. Calling another exe file requires a system call which incurs a lot of overhead. If it is possible I would just wrap you previous program in a wrapper … | |
Re: I would like to ask why you need to pass your array by value? | |
Re: Read a book, take a class, watch you tube tutorials. They're are lots of ways to learn C++, the question is how much time and money do you want to devote to it. | |
Re: What is the error you are getting? An `LPSTR` is just a `char*` and a `LPCSTR` is a `const char*`. Since `std::string` has `operaotr==(std::string, const char*)` you should be able to get rid of line 12 and change line 14 to `if (caption == s.dwTypeData)` | |
Re: line 5: `void print(string *ar[])` which becomes line 5: `void print(string **)` line 23 `print(&s)` which becomes line 23 `print(s)` Since the name of an array is the address of the array. In your code if you put before line 23 cout << s; cout << &s; You should get … | |
Re: When dealing with a 2d vector/array the first dimension is the row and the second dimension is the column. If you wanted to go through all of the elements you would need two loops, one for the number of rows and one for the number of columns. Putting that together … | |
Re: There are two main ways to delete a list that I know. You can use recursion or you can iterate. // recursion void delete(listNode node) { if (node.next != nullptr) delete(node.next); delete node; } // iteration void delete(listNode node) { listNode temp; while (node != nullptr) { temp = node.next; … | |
Re: B& operator=(const B& b) // Copy Assignment { if (&b != this) // you should always do this so you dont do a self assignment { A::operator=(b) // call A copy assignment i2=b.i2; } return *this; } | |
Re: So what seams to be your problem? We do not give answers here but we do offer assistance. ![]() | |
Re: Step 1: Write a problem statement for what you want to do Step 2: Write an outline, if it is complex Step 3: Write up a section in pseudo-code (English instructions) Step 4: Write the section in the programing language of your choice Step 5: Compile the program. Step 6: … | |
Re: I dont think so. Maybe you should read the [Rules](https://www.daniweb.com/community/rules). | |
Re: Isn't that question for you to solve? We will help you hear, not give you the answers. | |
Re: Line 167: `GenericPLayer::GenericPLayer(const string& name);`. Get rid of the semicolon at the end. Line 184: `class Player` Line 189: `virtual ~PLayer();` Do you notice the difference between the class name? | |
Re: I would split the string up into an vector of sub strings. Reverse each sub string in the vector. Then combine them all back together. You can easily split a string with spaces by using string streams: std::stringstream ss; string line = "What a sunny day"; std::vector<std::string> parts; string temp; … | |
Re: What do you need help with? Your instructor gave you how the program should function and work. Is there a part you don't understand? | |
Re: [This](http://blogs.msdn.com/b/heaths/archive/2012/03/07/why-visual-studio-11-requires-space-on-the-system-drive.aspx) details why this can't be done. There is a hack [here](http://www.placona.co.uk/1196/dotnet/installing-visual-studio-on-a-different-drive/) that you can do to get around this but it is not microsoft approved. | |
Re: That is because you have the declaration commented out on line 92. void Hand::Clear() { //iterate through vector , freeing all memory on the heap vector<Card*>::iterator iter = m_Cards.being(); for (iter = m_Cards.begin(); iter !=m_Cards.end(); ++iter) { delete *iter; *iter = 0; } //clear vector of pointers m_Cards.clear(); } Should … | |
Re: I would use the modulo operator (%) and division for this. Modulo gives you the remainder of integer division so `100 % 10 = 0`. So if `100 % 10 = 0` then you need to get rid of the rightmost 0 by division. Divsion by 10 will do that. … | |
Re: You have ab extra `}` on line 197. get rid of that and it should compile. No sure if your code is exactly right though. it looks weird that you have 3 `if(!found)` statements. | |
Re: Step 1: Write a problem statement for what you want to do Step 2: Write an outline, if it is complex Step 3: Write up a section in pseudo-code (English instructions) Step 4: Write the section in the programing language of your choice Step 5: Compile the program. Step 6: … | |
Re: Okay go ahead and get coding. Is there a part you dont understand? | |
Re: Did you copy this code from somewhere? I have a hard time believing that you could produce this code and not know how to generate random numbers. | |
Did a recent change happen to the spell checker? I could be wrong but now it is spell checking things inside code tags to where before I can't remember it doing that. I also had a weird result when spell checking with a web link where it changed the web … | |
Re: What problem are you actually having? Do you know how to find if two circles on a plane intersect? I don't think you will find anyone on here that is willing to do your work for you. To find out if two circles intersect you can see if the difference … | |
Re: Is there anything in particular you want to know. I don't think anyone on here is just going to tutor you in C++. ![]() | |
Re: If you really want to clear out the input buffer then you should use [Narue's code](https://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream). Calling `std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n');` should work almost always but as Narue mentions in her post there a a couple edge cases that will break it. | |
Re: You also need to get rid of line 23. that will force you out of the loop on the first iteration which is not what you want. | |
Re: First you have to write classes that will define every object that is represented in that scene. Once you have that then you need to use those classes in your code to create each object. Just from looking at the picture you are going to need at least 10 different … | |
Re: `while (!inFile.eof())` is never the way you want to read from the file. When reading the last line of the file the EOF flag does not get sent until it tries to read past the last line so `while (!inFile.eof())` will actually read all lines in the file plus one. … | |
Re: Well a queue is a FIFO data structure. In order to sort it you need to to find the smallest part by popping the front and checking it against a min variable. Then if it is not smaller push it back on the back of the queue. Do that until … | |
Re: Do you know how to output in C? Do you know to cast to different types in C? | |
Re: CTime_24& CTime_24::operator+=(int seconds) { m_Seconds += seconds; m_Minutes += this->m_Seconds / 60; m_Seconds %= 60; m_Hours += this->m_Minutes / 60; m_Minutes %= 60; m_Hours %= 24; return *this; } ////+= operator /// CTime_24 CTime_24:: perator+=(CTime_24& sTime) { m_Seconds = m_Seconds + sTime.m_Seconds; m_Minutes = m_Minutes + sTime.m_Minutes + m_Seconds / … | |
Re: This could be done very simply with the strings [] operator: int main() { std::string line; std::cout << "Please enter you string: "; getline(std::cin, line); // loop through each letter and add 2 to it while displayng it for(std::string::size_type i = 0; i < line.size(); ++i) { std::cout << char(line[i] … | |
Re: What are you supposed to do with the data when you get it? What part of reading in from the file is giving you a problem? | |
Re: What are you trying to do with this? From what I know about lambda's `[this]()->x` means: function that captures the this pointer and returns x and has no function body. It would be helpfull to see the use case for your macro. Also are you sure you want to use … | |
Re: `<cmath>` is the c standard math library. You would need to included it when you want to use the standard math function. [Here](http://www.cplusplus.com/reference/cmath/) is a list of all the functions contained in `<cmath>`. The header has also been updated with c++ functions parameters/returns that are not available in c. | |
Re: @ Fosterzone An array isn't just for int's. All an array is is a group of elements that all have the same type. each element is differentiated by a unique identifier (index). You can think of an array as a cubbyhole. The array has a number of spots equal to … | |
Re: What is the type of `category_name` | |
Re: I think you missed the most important part of the assignment. >You are required to write a program... | |
Re: What is the problem you are having? Taking some else's broken code and trying to use might not be the best approach. | |
Re: Can I ask what `char *strerror(num) int num;` means? I have never seen a function declared like that before. | |
![]() | Re: Well when you make a wrapper class you are basically redoing the public facing side of the class. Lets say the class has a bunch of everloads that you never want to be seen. What your wrapper class would provide is the one function you want and it would forward … |
Re: Someone probably can but you need to start your own thread and explain show the code that you have and what part you are having trouble with. |
The End.