First  |  Prev |  Next  |  Last
Pages: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
sscanf behaviour
In the following piece of code I get as result for f = 123457 instead of 123456.78. Any ideas how this could have happened? Thank you #include <iostream> using namespace std; int main(int argc, char* argv[]) { double f; const char *test = "123456.78"; sscanf(test, "%9lf", &f); cout<<f<<endl; retur... 23 Jul 2008 08:09
Order of destruct of local variables
Hi, Is the order of destruction of local variables of the function defined in the C++ standard? For example in the following function, is it always guaranteed that oAB is destroyed before oAC? struct AB{ ~AB(){} }; struct AC{ ~AC(){} }; int main(){ AB oAB; AC oAC; } I think the standard has refe... 29 Jul 2008 16:47
Finding the Median of 2 Vectors
Hi, I used nth_element() to find the medians m1, m2 of 2 separate vectors v1, v2, respectively. I now need to find the median m3 of the combined vector v3 = [v1 v2]. Is there a faster way to do this, using m1, m2, v1 and v2, other than just appending v2 to v1 and using nth_element() again? Thanks, Adi ... 21 Jul 2008 05:51
Finding the global maximum of a looong polynomial
{ Please confine responses to C++ related such as e.g. cross platform libraries -mod } This polynomial has a couple hundred terms (but less than 30 variables), I haven't tested it, but I think mathematica could find it's maximum, but I don't have access to mathematica. ( http://www.scientific-solutions.ch/tech/... 24 Jul 2008 07:45
Array vs Vector performance
I am experimenting with array and vector speeds using the following code snippets on Windows Visual Studio. The code accesses all elements of vector/array iterating several times. ------------------------------- code --------------------------------- // iterations static const size_t MAX_ITER = 1000; // siz... 24 Jul 2008 19:05
RValue Arrays
Hi, $4.2 states "An lvalue or rvalue of type �array of N T� or �array of unknown bound of T� can be converted to an rvalue of type �pointer to T�. The result is a pointer to the first element of the array." I was not sure about what is an rvalue array and hence a little googling threw up the following site "ht... 24 Jul 2008 14:58
using (void) in the parameter list
Alberto Ganesh Barbati wrote: Kush ha scritto: RunProgram::RunProgram(void) {} The use of "(void)" is provided for backward compatibility with C and is frowned upon in a C++ program. Just write "()". I have wondered, why is it frowned upon in a C++ program? I don't see any harm there. Did I... 24 Jul 2008 18:03
Hellp in handling 2^15 variables
My project involves lots of variables. I need to handle 2^15 double or float variables for the time being. g++ failed to handle as static memory. I tried using vector but no use. Please help me in getting out of this problem! Thank you in advance, Sai Krishna G -- [ See http://www.gotw.ca/resources/... 21 Jul 2008 05:51
Suggestions on map template / Library
Hello, I am new to stl & templates. I have a class with members as below: class DscInfo { char DiscId[255]; <Other data members - typically pointers to other objects & container objects>> }; I wish to create a container (typically this can hold upto 300 instances)and do object lookup based on the... 21 Jul 2008 06:53
Help with Compile Error :)
Hello, I am attempting to create a small program to teach a colleague how to program using C++ but I seem to be having my own difficulties with a compile error. It has been quite some time since I last wrote code in general, led alone in C++. I was wondering if someone wouldn't mind pointing out the source of... 20 Jul 2008 09:23
First  |  Prev |  Next  |  Last
Pages: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52