-
Replied To a Post in Reversing an answer
You're calling your `Reverse()` function over and over again, in a loop. This function doesn't have enough context to know exaclty what's going on and how to print things in … -
Replied To a Post in Should I get ubuntu?
> Should I get ubuntu on my mac? Is there a particular task that you want to accomplish on Ubuntu that you can't do on your current OS? It may … -
Replied To a Post in Reversing an answer
Because you're essentially looking at the least significant bit first, you're printing them first, and as a result, the number is being printed backwards. A couple of notes here. The … -
Replied To a Post in multiple definition of .. and undefined reference of.. c++
To be perfectly honest, the main way I would improve that code is to completely get rid of the `foo` class. It only has one actually peice of data in … -
Replied To a Post in multiple definition of .. and undefined reference of.. c++
First code: You're calling `mainPage()` as if it belongs to the global scope. The way you've written your code, though, it actually belongs to your class `foo`. My best bet … -
Replied To a Post in Optimization Experiment: Recursion vs. Iteration (with a twist!)
> Given that the code uses the C++ standard library and c++ only features such as templates, I rather suspect that this is making use of the g++ extension that … -
Replied To a Post in Optimization Experiment: Recursion vs. Iteration (with a twist!)
Ancient Dragon: Are you sure you're compiling as C and not C++? There are no VLAs in C++. -
Replied To a Post in sieve's algorithm for finding prime numbers between given range
You're erasing elements by position rather than by value. Once you start erasing values like that, you can't expect `v[number]` to be equal to `number` anymore. A better solution to … -
Replied To a Post in Where can I learn C++ game development online for free?
> Does anyone know if ubuntu is good for programming? It depends on what you're programming. For the most part, programming something in Linux is simpler than programming it in … -
Replied To a Post in Derived class "improving" base class
You would make the fuction virtual, which allows you to override the behavior of a function when defining the child class. It should be as simple as changing `void set_dimensions()` … -
Replied To a Post in Pipe implementation in C/C++
When you pipe two programs together via the shell, it actually just pumps the `stdout` of the program on the left into the `stdin` of the program on the right. … -
Replied To a Post in for_each output through global function access
> The for_each and lambda is clearly superior in the solution of this task. plain and simple )) Why? `for` doesn't even require you to write a function. -
Gave Reputation to WaltP in Detecting keypresses in an endless loop
And `main()` is **NOT** *void*. It's *int*. -
Replied To a Post in for_each output through global function access
Because that's not the syntax for range-based `for` loop. I can't imagine it would work with `for_each` either because you're iterating through `string`s, and your `add()` functions operates on and … -
Replied To a Post in for_each output through global function access
Is there any particular reason you're using `for_each` when you already have C++11's range based `for` loops available? Is it part of an assignment that your `add()` function has to … -
Replied To a Post in swap using for loop in c
main.c:7:6: error: 'i' undeclared (first use in this function) main.c:7:13: error: 'y' undeclared (first use in this function) main.c:9:3: error: 'x' undeclared (first use in this function) main.c:11:2: error: 't' … -
Replied To a Post in Is using functions and classes "ok" for developer organization?
> Is this memory efficient to split things up for developer "ease-of-use"? Even if it wasn't, it doesn't matter. Code maintainability and readability is a lot more important than shaving … -
Replied To a Post in help with iterator & array
Another way to print the values pointed to by the vector is to use C++11's new range-based `for` loops (if you have an up-to-date compiler). This way, you don't even … -
Replied To a Post in Linked list of chars In c
> That's quite a bit of difference, especially if there are thousands of nodes in the linked list. But don't compilers typically like to pad structs so that they are … -
Replied To a Post in about pointers and dot operator
What exactly is Vvariant supposed to be? It's impossible to get the value of a `void*` (without typecasting it first), and it's dangerous to dereference a pointer that is `NULL`.