General C++ Programming - April 2010 (Page 15)

get positive values from a vector
 
Hello, From the vector {1,2,-3,-4,5} I need to get only the positive values. Is there a way to do that except looping? Thanks, Bogdan
[1 reply] : http://www.cplusplus.com/reference/algorithm/find_if/ but if you ne... (by imi)
the "This" pointer.
 
I am really not getting what the "This->" pointer does. I have read and re-read my C++ book and I still cannot get what it does. Can anyone help clarify in ...
[2 replies] Last: I want to give it a shot! :-D Back in the old days, when there wa... (by imi)
Using OOP with a BST
 
I haven't really implemented yet, but I have a plan to make a program that uses classes to handle a binary tree. So I'm going to have a "node" class that has th...
[7 replies] Last: I thought the root of Smalltalk was Simula? (by imi)
Pertaining to .h files.
 
As I'm sure many have before me, I hope I am not asking too simple a question or too common of a question. I am trying to create a .h file such that my main ...
[2 replies] Last: Thank you, Disch. Looks like I was trying to over complicate it! A... (by Tristan)
operator* is ambiguous
 
Hey i'm trying to compile this program but it says that operator* is ambiguous. It worked until I added the second overload of that function and I called the op...
[1 reply] : i resolved the problem, I just had to call the constructor VM... (by valleymannn)
how exactly do you do a binding?
 
sorry if this has been brought up before. I did lots of searching here before I decided to post. This is my first post here. I have used the site for some time ...
[1 reply] : Most other languages have an dynamic library that links using C functi... (by Duthomhas)
by gpapa
Arrays
 
1. Consider the following array definition: int values = {4,7,6,8,2}; What does each of the following statements display? cout << values << endl; cout...
[2 replies] Last: Since the OP has no questions, I assume its to share fascinating excer... (by maikel)
Writing a library for linux and windows?
 
Hi, perhaps someone can give some links or other info about how should a C++ library be written, so it can be compiled for both Linux and Windows applications?
[2 replies] Last: Well, thanks... Too general question, sorry. Maybe later I come back h... (by KarlisRepsons)
Polymorphism, virtual
 
Hi, I've got two classes: One and Two. Class One is base class for Two. Both classes have "Run" function. When I write in main function something like this: ...
[2 replies] Last: More accurately the compiler adds a pointer to the virtual method tabl... (by jsmith)
Not writing to file on unObfuscate
 
I have a program thats a user defined integer to each character of a file, and stores it in another file. I am supposed to take that, and reverse the encrypt...
[no replies]
*directoryiterator using Boost
 
I'm trying to store the value that the iterator points to in a directory iterator as a string. if( bfs::is_regular_file( *dirIter )) x.name_ = *dirIter...
[no replies]
by NGen
Template Specialization
 
Let's say I have a template class: template <typename Type1, typename Type2> class SomeClass { ... }; I want to specialize it for one specific template...
[2 replies] Last: Alright, thanks. For some reason the term 'partial' completely eluded ... (by NGen)
sorting corresponding arrays
 
Say I have two integer arrays, {a1,a2,...,an} and {b1,b2,...,bn}. Can I sort the first array (in increasing order) and then move the members of the second array...
[5 replies] Last: I came up with a better way to do this: #include <boost/foreach.... (by maikel)
unipolar stepper motor program
 
i have to write a c++ program that should be able to drive a unipolar stepper motor but through an open usb in full mode, you have to read the status of the mot...
[no replies]
Trying to overload the = operator to do a deep copy
 
I am currently having some issues with overloading the '=' operator to perform a deep copy of a linked list in a templated class. For whatever reason, the sourc...
[5 replies] Last: Also, do not name your parameter "list" if you are going to use the en... (by jsmith)
sub class constructor calling its "super constructor"
 
I have a super class and a sub class defined as follow class Super { public: double x; Super ( double x ): x(x) {} Super() { Super(0)...
[1 reply] : Base class constructors can only be called via initializer list. (by jsmith)
by fafner
Finding an objects place in an array
 
This is probably a n00b question. I have an object that when initialized takes a randomly selected value from an array. Is there a way to later determine the po...
[3 replies] Last: Ah, thanks! I solved, however, by storing the index in an integer valu... (by fafner)
by wrz234
round up
 
i declare double as double amount,rate = 0.3333; int money = 30; amount = rate * money; printf("%f", amount); so the output will be 9.999 if ...
[7 replies] Last: Yes, exactly. It is an interesting problem you had. (I had never he... (by Duthomhas)
Shared library problem
 
Hi all, I don't know if this is really a c++ problem or not but I'm using c++ so I thought it was worth posting here to see if anyone has the same problem an...
[no replies]
passing whole 1d array to function by call by value(integer)
 
how can i demonstrate this thing I am very new to pointers and have just a bit of knowledge in it.... Till now I have attempted only the programs given in m...
[2 replies] Last: First, why do you want to pass an array by value? It can be done in o... (by kempofighter)
April 2010 Pages: 1... 1314151617... 24
  Archived months: [mar2010] [may2010]

This is an archived page. To post a new message, go to the current page.