Posts
 
Reputation
Joined
Last Seen
Ranked #458
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
95% Quality Score
Upvotes Received
25
Posts with Upvotes
24
Upvoting Members
17
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
7 Commented Posts
0 Endorsements
Ranked #630
~22.4K People Reached
Favorite Forums
Favorite Tags

69 Posted Topics

Member Avatar for sjcomp

[QUOTE=sjcomp;1148820]Hello, I am using a singleton pattern, which works fine. But when I decided to have a singleton of a nested class that is privately declared. [CODE]class A : public CSingletonTmpl<A> { class B : public CSingletonTmpl<B> { }; }; A* CSingletonTmpl<A>::s_Singleton = NULL; A::B* CSingletonTmpl<A::B>::s_Singleton = NULL; [/CODE] The …

Member Avatar for madGambol
0
250
Member Avatar for shrutinr

[QUOTE=shrutinr;1186620]Hi , I m doing my project in vc++.. I need to interact my vc++ project with NI MAX software.. I m taking Frame API for ineracting to UPS . I included "nican.h" header file for that. I didnt missed any brackets... but while executing i m getting error like …

Member Avatar for Smalls518
0
957
Member Avatar for Donnovan

No. This will increment the pointer first and then deference the result. You would require paretheses here to achieve the result you want. [CODE](*size)++[/CODE] This is because unary unary operators like ++ associate right to left.. Also you have a problem in that the expression [CODE]int *size = n; [/CODE] …

Member Avatar for sweetyk2
0
89
Member Avatar for blackmagic01021

[QUOTE=blackmagic01021;1198621]I have a void type array. I want to create a function which will read 12 bits in each time and store it in a unsigned int type variable. Any ideas? Thank you.[/QUOTE] So you wish to extract the first 12 bits from each element in your void array? How, …

Member Avatar for Banfa
0
3K
Member Avatar for punchinello

~077 is the unary of the octal value 77; octal 77 will correspond to the low order 6 bits being set of a word. In 32 bit hex word 0x0000003f. the unary of this flips all the set bits to 0 and all 0 bits to 1 giving 0xffffffc0 this …

Member Avatar for punchinello
0
79
Member Avatar for VilePlecenta
Member Avatar for Banfa
0
131
Member Avatar for john10

>> will read to the next whitespace. ie. space character so it wont pick up your space. Do you have to use space? You can explicitly read the next char from the stream though. Check out the other stream functions available to you. Is there anything else you could use.

Member Avatar for john10
0
2K
Member Avatar for replax

I'm not sure I fully understand your question here. Could we see some code. Just pare down some example classes to the bare minimum required to illustrate what your question is asking and post them.

Member Avatar for mattjbond
0
233
Member Avatar for Loranus

Dictionaries are generally represented by a form of Map as mentioned in previous posts. your solution will wind up with you having many thousands of distinct objects, one for each word entered. this seems to me to be a bit messy. Try reading up on Maps before moving on...

Member Avatar for mattjbond
0
109
Member Avatar for n.utiu
Member Avatar for atticusr5
Member Avatar for Naftel23

add the scores together and divide by three. Or if you have n values to average add em together and divide by n.

Member Avatar for Naftel23
0
74
Member Avatar for vbx_wx

Is that what HKEY_CURRENT_USER is defined to? I'm not going to check for you but I suspec that it is. You would need to provide some method of producing a textual representation of this defined value and printing that instead of the value itself.

Member Avatar for vbx_wx
0
72
Member Avatar for daviddoria

[QUOTE=daviddoria;1183663] [code] queue a; a.push(1); a.push(2); a.push(2); a.push(3); [/code] to only have 3 elements, because 2 was added twice so the second time it is just ignored. [/QUOTE] But you want this to have FIFO behaviour? Why not create your own queue class, based on a deque for instance, which …

Member Avatar for mattjbond
0
166
Member Avatar for DawnDenise

I doubt that this will even compile as it stands. You have no return from your longWords function. As for converting a function from an array to a pointer it should not make too much of a difference. When you pass an array argument as a pointer you are passing …

Member Avatar for mattjbond
0
159
Member Avatar for anuj10

or if you wish to read the data items one at a time [CODE] ifstream openFile( "Data.txt" ); float temp; while( openFile >> temp ) { ... }[/CODE] When you write [CODE]openFile >> temp[/CODE] the return value of the input statement is the class object from which you are reading …

Member Avatar for mattjbond
0
267
Member Avatar for shilpa.joshiv@g

[QUOTE=shilpa.joshiv@g;1182773]hi,,, i have converted the image in to gray and created itz histogram...nw i m applying various filters on the gray image...my problem is: 1.. want to display the result image after filtering in dialog box... for this i have created the dialog class...but not getting how to send the …

Member Avatar for mattjbond
0
113
Member Avatar for Darkwarrior_331

Traditionally a dictionary would be represented as a Map. Where the word would act as the key value into the map and the definition would correspond to the value for that key. Maybe you could produce a map for language conversion where the key value is a word in the …

Member Avatar for mattjbond
0
150
Member Avatar for deanus

[QUOTE=deanus;1181033]Hi I've just started out in c++, can anyone tell me how to use pointers which hold addresses of objects ? How do you access the object fields from this type of pointer, especially strings (array of chars)... I'm using a Dev c++ 4.9.9.2 compiler....[/QUOTE] you might want to post …

Member Avatar for deanus
0
107
Member Avatar for ischuldt

SESE (single entry single exit) was quite a big thing at one point, more especially in C as it was felt that it made functions easier to maintain amongst other things. In C++ where you have exceptions as another way in which a function can be exited it is difficult …

Member Avatar for Fbody
0
135
Member Avatar for metdos

Depends how much you want to increase it by. Simply declare it in a lerger scope. instead of [CODE]MyClass *stable; if(..){ MyClass temp; stable=&temp; } stable.myVariable;[/CODE] try [CODE]MyClass *stable; MyClass temp; if(..){ stable=&temp; } stable.myVariable;[/CODE] if you really don't want temp hanging around any longer that necessary then enclise it …

Member Avatar for mattjbond
0
177
Member Avatar for myluvstefan

[QUOTE=myluvstefan;1177841]Hi, I've spent a lot of time on this program and I'm stuck. My assignment is to prompt for two input strings. Print out each string Concatenate string1 and string2 and store the concatenated string into string3 without changing what's stored in string1 or string2. print out the concatenated string. …

Member Avatar for mattjbond
0
353
Member Avatar for LemonLemon

[QUOTE=LemonLemon;1180716]I am using VC++ 2008. I want to rotate the Bitmap in my MFC application. I tried the GetPixel and SetPixel functions, but the performance is too slow. There seems no Bitmap rotation example using MFC class on the internet Can anyone give me some idea? Sample code will be …

Member Avatar for mattjbond
0
133
Member Avatar for theblastedfool

you need to declare stream objects of type ifstream. eg. [CODE] ifstream inputfile; inputfile.open(filename);[/CODE] ifstream is a class definition, not a concrete object which you can use. You have to declare an instance of the class to use it. Looking again I see you have done so in you main. …

Member Avatar for mattjbond
0
215
Member Avatar for rkp728

If your code is as posted then the only problem I can see is the extra ',' in you function prototype. [CODE]void Find(uint4& a, uint4 b, uint4 c[B][I],[/I][/B]);[/CODE]

Member Avatar for mattjbond
0
76
Member Avatar for trantran

> This is likely a stupid question, but I can't figured out by myself how to pass a pointer to a member function of a templatised class in its own template parameters. > More clearly: > I would like to have this to work out: template <typename T, T test::* …

Member Avatar for trantran
1
565
Member Avatar for timbomo

As I have told you in one of your numerous other posts on this subject you need to get hold of an introductory programming text and read the first couple of chapters. You are lacking in some really fundamental concepts here, how to declare and use variables, how to declare …

Member Avatar for mattjbond
0
413
Member Avatar for rkp728

[QUOTE=rkp728;1175860]I want to fill a structure and then print it. How to print the values of the structue? The structure is: [CODE] #define UINT32 unsigned int #define INT32 int #define UCHAR unsigned char typedef struct CheckSumPair { UINT32 weakcs; // The weak, rolling Adler32 checksum. UCHAR StrongCS[10]; };[/CODE] I have …

Member Avatar for Banfa
0
358
Member Avatar for timbomo
Member Avatar for timbomo

Default arguments should be at the right of the declaration. eg. [CODE]int func( int x, int y = 1, int z = 2 );[/CODE] you cannot have variables which do not have a default definition on the right hand side of those that do. [CODE]int func( int x = 1, …

Member Avatar for mattjbond
0
189
Member Avatar for AltF4me

You should also be aware that your class will require a copy assignment operator and also a destructor to properly handle your dynamic array. Do a search for the 'rule of three' for details on this. Also do a search of Marshal Clines C++ faq lite (google for it) for …

Member Avatar for AltF4me
0
112
Member Avatar for merse

[I][/I][QUOTE=tetron;1169267]const is a some what overrated concept that leads to more typing and maintenance. In your case myfunc is not const as it alters a member variable if this is not appropriate to be altered then you need to use a local [CODE] double myfunc(double x1,double x2, double x3) const …

Member Avatar for mattjbond
0
172
Member Avatar for o0mkh0o

I wonder what you are expecting to see? I haven't had much need to use the typeid operator to date so I have had fun fiddling around with this. The exception you see indicates that you are attempting to use typeid on an expression that equates to an invalid object. …

Member Avatar for o0mkh0o
0
330
Member Avatar for italian

[QUOTE=Banfa;1168109]You seem to be treating as a single step, get the return value of a function, what is actually 2 steps [list=1]Return a value from a function [*]Assign that value to a variable [/list] Both have associated efficiencies as follows [b]Return a value from a function[/b] [list]Return by value - …

Member Avatar for mattjbond
0
1K
Member Avatar for yapkm01

You already have two very good books. Try reading the C++ primer for an introduction to the language, and don't be fooled that it doesn't cover what the C++ programming language covers as it will cover all language features. Then when more comfortable with the language use the cpppl for …

Member Avatar for mattjbond
0
158
Member Avatar for LemonLemon

Marhsal Clines C++ FAQ Lite has a nice section on object serialization covering various options open to you. This is a very good place to start. [URL="http://www.parashift.com/c++-faq-lite/serialization.html"]http://www.parashift.com/c++-faq-lite/serialization.html[/URL]

Member Avatar for Ancient Dragon
0
97
Member Avatar for herrstarr

If this is your exact code then [I]to begin with[/I] you should look for missing semi colons. I wonder what you are using to compile this?!?

Member Avatar for mattjbond
0
132
Member Avatar for abhimanipal

Both of the previous responses to this question were incorrect. The code snippet you see here is perfectly valid and is an idiom oft used by the STL. The struct g represents a function object, or functor. It overloads the function call operator, that is its purpose. What this means …

Member Avatar for mattjbond
0
159
Member Avatar for Hawkpath

What is the signature of this function? glColor3f is this a function you have specified yourself? If so it seems as though the function is expecting an int where you have provided an array. Did you forget a '*'?

Member Avatar for mrnutty
0
191
Member Avatar for dorkwad
Member Avatar for Sune

Both would work, but my view here is that both classes should provide the overloaded operator. Obviously these classes are contrived, in a real world example the method of only providing the overload in the one class could very quickly get messy if the contained classes were complex.

Member Avatar for tetron
0
219
Member Avatar for BobC22

What you are discussing here is termed serialization, or sometimes object persistence. Boost contains an excellent library which will handle all of this for you and is worth researching. Serialization is a non-trivial exercise with some interesting design choices which have to be made before selecting an implementation. Check out …

Member Avatar for mattjbond
0
825
Member Avatar for sid78669

your code is not organized correctly. Although it is traditional to organize definitions into header files and implementation into .cpp files this will not work effectively for tempates. As you have found a compiler will generally accept this but it will not ge by the linker. The reason for this …

Member Avatar for sid78669
1
637
Member Avatar for i_luv_c++

by doing a comparison for 'q' you are comparing a string to a char which is not supported. first thing to try "q"... then maybe more errors may become apparent...

Member Avatar for i_luv_c++
0
136
Member Avatar for mattjbond

I am curious about how to post or have published tutorials. I have searched the forum but the latest information I cna find is years out of date. Any help here?

Member Avatar for mattjbond
0
93
Member Avatar for dmane

I think that your test case here is ill advised. Here is why... The accumulate function is expecting a binary function as its fourth parameter. bind2nd returns a unary function (that is its purpose) by binding a value with the second parameter of a binary function. This allows use of …

Member Avatar for mattjbond
0
129
Member Avatar for rajeevkag

Simply declare the vector globally as yoiu would a normal global variable. The add the values you require to the vector using one of the methods availlable to vectors, e.g. push_back(). After that you shouldn't need to do anything. As a vector supports the subscript operator the rest of your …

Member Avatar for rajeevkag
0
97
Member Avatar for photoyid

[QUOTE=photoyid;1154214]So I am working on a faux graphics program for class. The current part that I am working on is to determine just from top left and bottom right corners what the coordinates should be. I believe my logic is good but it seems to be setting it as tl(3,1) …

Member Avatar for WaltP
1
148
Member Avatar for iamvish

[QUOTE=iamvish;1154491]Hi all, How to find free physical memory... I am using new operator to allocate memory.. I tried GlobalMemoryStatus (windows api) to analyse the current free memory. new is giving exception still GlobalMemoryStatus shows sufficient free memory.. I am using visual studio 2005 for development. and I want to avoid …

Member Avatar for WaltP
0
85
Member Avatar for bhp2005

instead of allocating arrays of char pointers try allocating a contiguous region of chars which is large enough to hold the whole board. Eg. board width = 10 board height = 5; char *board = new char[width * height]; now you can simply index into the char array using a …

Member Avatar for bhp2005
0
171

The End.