|
you have the maximum number for the combination like that :
long lMax = 0;
CString str = ;
for (int i = 1; i < str.GetLength(); i++) {
lMax += 9 * ::pow(10, i);
}
then, you iterator from 0 to lMax...
|
|
|
|
|
Sorry sorry I have awaken and realized ...
I need to code the parsing of:
given the number of dimensions N
say N=6
and given the maximum number of single dimension size
say a,b,c,d,e,f a=300,b=100,c=400,....
to parse thru all possible combinations of them
from 0,0,0,0,0,0
1,0,0,0,0,0
2,0,0,0,0,0
...
...
a,b,c,d,e,f
the total number of combinations will be a*b*c*d*e*f
9ine
|
|
|
|
|
if anyone can suggest better code?
m_dsize[] = {a,b,c,d, .... }
pos[] = {0,0,0,0, ... }
//pos will be filled with all possible configurations
while(true)
{
//increment counter
for(int i=0; i<dim; i++)
="" {
="" pos[i]++;=""
="" if(pos[i]="">=m_dsize[i])
pos[i]=0.0f;
else
break;
}
float sum=0.0f;
for(int i=0; i
|
|
|
|
|
9ine wrote: if(!sum) break;
Why are you using a logical NOT operator with a float ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I thought it was not forbidden. why not float value stored as 32 bit number and if it is 0.0 then its 32 bit equivalent 0x00000000
9ine
|
|
|
|
|
9ine wrote: I thought it was not forbidden.
Just because something is syntactically correct does not also mean it is good practice.
9ine wrote: why not float value stored as 32 bit number and if it is 0.0...
Using the equality operator with float (or double ) is a really bad idea.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi,
Does anyone know how I can remove the highlight selection in the listview control. I just want to be able to have the user to select the checkboxes.
Thanks.
|
|
|
|
|
Use the SetItem() method to turn off the LVIS_SELECTED state.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
You can use the following method to modify the state
for removing of selection where
state = 0
nMask = LVS_SELECTED
SetItemState( int nItem, UINT nState, UINT nMask );
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
-- modified at 0:36 Wednesday 5th April, 2006
|
|
|
|
|
Hi,
I've done a dialogbased project and created databases(MSACCESS) using recordset(class wizard).Now my problem is where do u declare this m_pSet?
In SDI u do it in VIEW Class,but in dialogbased where do u do it?
I get the foll errors when I execute the program:
m_pSet :Undeclared identifier
pls help me
swapna_signsin
|
|
|
|
|
i think you are trying to reuse some code you saw somewhere on the web.
i don't know what type is m_pSet , but refering to its name, ,i think it could be a CRecordSet*
and as there is a prepending m_ it means that it is a member of a class.
but tell me where you found your source ??
|
|
|
|
|
hi,
well thats right,it was the method I used in SDI application in which m_pSet gets automatically.It is a recordset.
Actually Iam a beginner to databases and I just wanna connect my database(MSACCESS) with two fields name and grade thru dialogbased.
How do u think I should proceed?
bye
swapna_signsin
|
|
|
|
|
swapna_signsin wrote: In SDI u do it in VIEW Class,but in dialogbased where do u do it?
Make it a member of the dialog class.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi,
I am using a slide control in a dialog and I used Visual studio to create it and place the slider on it.
When I want to add the tick marks, I have a problem. I must use the Create function for that with the "TBS_AUTOTICKS" flag, but the problem is that I can't use the Create function since Visual Studio already did it for me using the macros.
Any way to set this flag or override the Create function macro ?
Shay
|
|
|
|
|
Just check the "Auto ticks" checkbox in the resource editor.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Why couldn't I think about it before
BTW, I am using VS 2003 and it also need the Tick Marks property checked.
Thanks !
|
|
|
|
|
I use double buffers to draw a rectangle.I add codes in OnPrepareDC() function:
{ CScrollView::OnPrepareDC(pDC, pInfo);
pDC->SetMapMode(MM_ISOTROPIC);
pDC->SetWindowExt(CSize(100,100));
pDC->SetViewportExt(CSize(300,300));
}
In OnDraw() function,I wrote this:pDC->BitBlt(....,&dcmem,0,0,SRCCOPY);
I found that the rectange became lager and thicker than its original state(In its original state, I wrote pDC->SetViewporOrg(CSize(100,100)) in OnPrepareDC
function )The problem is ,when I changed the mapping mode of Memory DC(memDC),that is,I used this code OnPrePareDC(&dcMem),I found that the rectangle's size got larger but the line width couldn't become larger,what's the diffrence?plz help.
|
|
|
|
|
If your pen width is 0, you will always gets a border or line width of 1 pixel.
(On a side note, MM_ISOTROPIC and double buffers can exhibit rounding errors in the form of streaks and smudging when changing the window and viewport extents. I posted a comment about this in Keith Rule's article in the "Font's and GDI" section of CP. If you drag your "help about" window over your double buffered client area, you will see smudging and/or remnants due to rounding errors. I put a clickety to a helpful link to an (old) Microsoft article that will adapt a solution to your project in that comment.)
|
|
|
|
|
how to allocate in loop any given number of dimension for multidimensional array
like static int m_arr[10][20][15][5][] .... [] ... but do it dynamically
9ine
|
|
|
|
|
you must allocate dimensions one by one...
|
|
|
|
|
Another approach, which should simplify this a bit, is a structure with member functions.
Pointer or vector
Kuphryn
|
|
|
|
|
I've choosen to store multidimensional indeces of all possible combinations
see my topic hackers delight, ....
9ine
|
|
|
|
|
Hi,
Is there any way to Increase the Height of the status Bar?
|
|
|
|
|
|
RockyJames wrote: Is there any way to Increase the Height of the status Bar?
you have to subclass the statusbar and implement Subclassed statusbar there
|
|
|
|