Forum: C++ Oct 3rd, 2009 |
| Replies: 2 Views: 282 Why don't you write that for getting input from the user:
string breed;
cin >> breed;
This method does not get the "\n". |
Forum: C++ Sep 2nd, 2009 |
| Replies: 16 Views: 1,049 If your operator=() works, extract the code that creates a new list with the one provided as a parameter and use it in your copy constructor. Search for the refactoring tip Extract Method. |
Forum: C++ Sep 2nd, 2009 |
| Replies: 4 Views: 281 According to http://msdn.microsoft.com/en-us/library/yt4xw8fh.aspx :
The /Wp64 compiler option and __w64 keyword are deprecated and will be removed in a future version of the compiler. If you... |
Forum: C++ Sep 1st, 2009 |
| Replies: 9 Views: 400 If you are using UNIX, you can use valgrind to check for memory leaks. You need to add --tool=memcheck on the command line to check for leaks. |
Forum: C++ Sep 1st, 2009 |
| Replies: 4 Views: 281 For the step 13, it tells Visual Studio to include these libraries for the link, because the functions you are using with SDL are implemented in these libraries. The librairies must be in the... |
Forum: C++ Aug 31st, 2009 |
| Replies: 5 Views: 461 You can implement a sort strategy on your linked list, like bubble sort, quick sort, merge sort. Some strategies do not require an additionnal container for the answer. |
Forum: C++ Aug 31st, 2009 |
| Replies: 2 Views: 249 It is normal that you jump directly to system("pause") when the operator is not correct the first time. You are leaving the if-else clause after the second input prompt. You should do something... |
Forum: C++ Aug 31st, 2009 |
| Replies: 1 Views: 394 You should pay attention to how you have divided your problem into functions.
A function like computeCommission(int price) can be useful... |
Forum: C++ Aug 31st, 2009 |
| Replies: 5 Views: 461 http://www.codeguru.com/forum/showthread.php?t=366064
You can use std::sort with a STL container, like a vector or a list. You will need to write a function that determines if a element is greater... |
Forum: C++ Aug 31st, 2009 |
| Replies: 5 Views: 170 Your main() should be in an other file... |
Forum: C++ Aug 30th, 2009 |
| Replies: 11 Views: 597 Looks good, but there is a piece of code I would like to show you:
if(is_door_opened==true)
You can simplify this conditionnal expression with:
if (IsDoorOpened())
and make this method... |
Forum: C++ Aug 30th, 2009 |
| Replies: 3 Views: 199 This behavior is expected, because the operator >> of cin reads input in his stream until a end-of-line or a whitespace is found. So, the next operator>> call finds remaining input (the other words... |
Forum: C++ Aug 30th, 2009 |
| Replies: 5 Views: 421 I did a mistake in my last post: the >> operator reads data until a end-of-line character OR a whitespace is found. |
Forum: C++ Aug 30th, 2009 |
| Replies: 1 Views: 203 http://www.csse.monash.edu.au/~jonmc/CSE2305/Topics/10.19.OpOverload/html/text.html
On this page, look the Complex class example at the bottom. It explains that you need to declare the prototype... |
Forum: C++ Aug 30th, 2009 |
| Replies: 4 Views: 243 This site helped me a lot to understand the design patterns:
http://sourcemaking.com/design_patterns |
Forum: C++ Aug 30th, 2009 |
| Replies: 5 Views: 421 Are you sure that the file denoted with the name you provided exists?
I'm pretty sure that the answer is yes, but do you really have gSize vertices in your file? Do you really have a line at each... |
Forum: C++ Aug 3rd, 2009 |
| Replies: 0 Views: 260 Hello everyone!
I'm having a bad time trying to find a solution to my problem:
I'm developping a client-server application. On the server side, I am calling a method, Recoit (receive), that... |
Forum: C++ Jul 29th, 2009 |
| Replies: 2 Views: 165 Thank you for your help. It worked when I added pcslib.cpp with the other file on the command line with g++. |
Forum: C++ Jul 29th, 2009 |
| Replies: 2 Views: 165 Hello, everyone! It's been a long time using C++ and I have a link problem.
This is the code...
#include <iostream>
#include "libc++/pcslib.h"
int main()
{ |
Forum: C++ May 6th, 2009 |
| Replies: 2 Views: 431 There are options in the "Compiler" section in Code::blocks to make a faster executable. This will result in a longer compilation, but the program will be faster.
On Visual Studio, you can compile... |
Forum: C++ Apr 6th, 2009 |
| Replies: 2 Views: 272 If you want to remove an element and not reduce the size of the vector, erase() is not an option. You can have a vector of pointers of Suitcases and point the pointer to 0 (after freeing the memory... |
Forum: C++ Apr 5th, 2009 |
| Replies: 12 Views: 586 I'm glad that you found the error yourself!
Don't forget to mark the thread as solved. |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 Have you created a new project or have you just opened the file? Opening the file only prevents you from building the executable. You must create a project. |
Forum: C++ Apr 5th, 2009 |
| Replies: 12 Views: 586 No problem. Let me know if you need more help. |
Forum: C++ Apr 5th, 2009 |
| Replies: 12 Views: 586 I'm sorry. pop() removes the first element without returning it (if you're using std::stack). top() returns the value of the top, and pop() removes the top. You should use top() with push() and do... |
Forum: C++ Apr 5th, 2009 |
| Replies: 12 Views: 586 You don't want to push another stack, you want you push an element of the other stack, so call pop(), like this:
stackThree.push(stackTwo.pop()); //This will push the elements in reverse order.
... |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 See this address for the express edition, I recommend it instead of VC++ 6.0:
http://www.microsoft.com/Express/ |
Forum: C++ Apr 5th, 2009 |
| Replies: 12 Views: 586 stackThree.push(stackTwo.pop());
Note that the elements will be in reverse order. If you want the same order, you should use a queue or an array (or another thing that keeps the stack content).
... |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 Maybe you have a specific setting, a flag or something. Check this page:
http://social.microsoft.com/Forums/en-US/vcgeneral/thread/d2677732-d756-42e5-b2f1-5b040819c037
Don't forget that a... |
Forum: C++ Apr 5th, 2009 |
| Replies: 10 Views: 518 Do you have a 64-bit machine?
Have you tried to restart Visual Studio and build again your solution?
Also, I know that a "Clean Solution / Rebuild Solution" solves a lot of problems.
You can... |
Forum: C++ Apr 5th, 2009 |
| Replies: 7 Views: 2,552 The functions look good. Don't hesitate to ask for help. I don't have code example for polynomials, sorry. I suppose that your previous post contains pseudo-code, because p1 and p2 objects, if there... |
Forum: C++ Apr 4th, 2009 |
| Replies: 5 Views: 622 See strtok(), a C library function. It may solve your problem.
http://www.cppreference.com/wiki/c/string/strtok |
Forum: C++ Apr 4th, 2009 |
| Replies: 5 Views: 587 There's no way to ask the stream for the filename. I know that the stat or stat64 function on Unix (it's _stat or _stat64 on Windows) returns a struct that name the filename inside. The problem is... |
Forum: C++ Apr 4th, 2009 |
| Replies: 7 Views: 2,552 You can use the power of object-oriented approach and create a Polynomial class that is represented by a List object as a attribute. For example, a getDegree() method returns the getSize() method on... |
Forum: C++ Apr 4th, 2009 |
| Replies: 7 Views: 689 The last suggestion respects the rules. |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 382 Don't forget to make the thread as solved. |
Forum: C++ Apr 4th, 2009 |
| Replies: 7 Views: 689 Ok, declare an array of queue elements, pop() while empty() returns false and push() all the elements except the last one that has been popped. An easy task with the use of loops and a control... |
Forum: C++ Apr 4th, 2009 |
| Replies: 6 Views: 382 According to cplusplus.com (http://www.cplusplus.com/reference/string/string/append.html) ...
string& append ( size_t n, char c );
Appends a string formed by the repetition n times of... |
Forum: C++ Apr 4th, 2009 |
| Replies: 7 Views: 689 Use a function that returns the last element of the queue (depending of the representation of the queue), then search in the queue for that value and if you find something, use delete and set... |
Forum: C++ Apr 4th, 2009 |
| Replies: 1 Views: 481 I don't understand the meaning of the lSwitch...
Can you check the true length of the filename (with debugging)? It may have unwanted spaces at the end... Did your terminal screen have more than... |