|
The code produces the sequence you need, doesn't it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry yes i need it.
Thanks
|
|
|
|
|
Hello sir
when i try to make combination of 3char then whats approach you advice me.
Example;
"ABC"
{a,a,a} {a,a,b} {a,a,c} {a,b,a} {a,b,b} {a,b,c} {a,c,a} {a,c,b} {a,c,c} {b,a,a} {b,a,b} {b,a,c} {b,b,a} {b,b,b} {b,b,c} {b,c,a} {b,c,b} {b,c,c} {c,a,a} {c,a,b} {c,a,c} {c,b,a} {c,b,b} {c,b,c} {c,c,a} {c,c,b} {c,c,c}
Please help me
|
|
|
|
|
My advice is: go recursive.
However, I guess you need an example:
#include <stdio.h>
#include <string.h>
void step(char sSeq[], int len, char sOut[], int level, const int depth)
{
for (int i=0; i<len; i++)
{
sOut[level-1]= sSeq[i];
if ( level == depth)
printf("%s\n", sOut);
else
step(sSeq, len, sOut, level+1, depth);
}
}
int main()
{
char sSeq[]="ABC";
int len = strlen(sSeq);
const int DEPTH = 3;
char sOut[DEPTH+1]={'\0'};
step(sSeq, len, sOut, 1, DEPTH);
return 0;
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry for late reply..
Thanks....
You solve my big problem..
|
|
|
|
|
You are welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
i m open CFileDialog to browse file,
in this manner " CFileDialog fileDlg(TRUE, NULL, NULL, OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_OVERWRITEPROMPT,_T("Text Files|*.txt|Excel Files|*.xls;*.xlsx|"));
"
some time it works but some times it become not responding and crash on Windows server 2008.
please help me what can i do.
thanks for help in advance.
|
|
|
|
|
xlsx|")); is missing the end-pipe => xlsx||"));
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Now i m chk it with "||" end pipe.but still problem is exist.
and diaplay these details in more info:
<br />
Problem signature:<br />
Problem Event Name: APPCRASH<br />
Application Name: Test.exe<br />
Application Version: 6.0.1.4<br />
Application Timestamp: 4bbd6e29<br />
Fault Module Name: Secur32.dll<br />
Fault Module Version: 6.0.6001.18000<br />
Fault Module Timestamp: 4791a777<br />
Exception Code: c0000005<br />
Exception Offset: 000021b3<br />
OS Version: 6.0.6001.2.1.0.274.10<br />
Locale ID: 1033<br />
Additional Information 1: 98e2<br />
Additional Information 2: 6076d0439494b3c22f752162dd29dcbf<br />
Additional Information 3: 4f76<br />
Additional Information 4: e360291dec91efb6c8036cc8226e0089<br />
<br />
Read our privacy statement:<br />
http:
<br />
please help me.
|
|
|
|
|
it looks strange like "dll hell".
Check for actual dlls on the server and you dev-pc. Consider static linking.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I have trouble with declaring my array size so as to avoid the stack overflow error:
_variant_t raw_data[10000][100]
_variant_t results[10000][100]
i read somewhere about dynamic sizing, i tried this but it didnt work
_variant_t *raw_data = new _variant_t [10000][100]
any help would be very much appreciated..
|
|
|
|
|
buki86 wrote: i read somewhere about dynamic sizing, i tried this but it didnt work
Why not?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
IIRC stack space is limited to 1MB, so you can't create a stack-based array holding 1M elements. You could dynamically allocate it though, using malloc() or new.
|
|
|
|
|
I'm going by memory, too, but I think the default stack is 1 Meg but you can set it to be a different size as part of the build. I've never personally done it though.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Tim Craig wrote: but you can set it to be a different size as part of the build.
yeah, that is very plausible, however I never have done so for a Windows app.
|
|
|
|
|
Tim Craig wrote: but you can set it to be a different size as part of the build.
yeah, that is very plausible; it is common practice for embedded systems, however I never have done so for a Windows app.
|
|
|
|
|
You remember well [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I remember a poem in Mad Magazine in the late 50's that went "I remember, I remember...", but I can't remember what they remembered.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
You are lucky. On the other hand:
"I don't remember, I don't recall
I got no memory of anything at all"
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Try with malloc, that can used to represent multidimensional array.
int **nArray;
int nRows = 10000;
int nColumn = 100;
nArray = (int**)malloc(nRows * sizeof(int *));
ZeroMemory( nArray, 0 );
if( 0 == nArray )
{
return 0;
}
for(int i = 0; i < nRows; i++)
{
nArray[i] = (int*)malloc( nColumn * sizeof(int));
if( 0 == nArray[i] )
{
return 0;
}
}
Величие не Бога может быть недооценена.
|
|
|
|
|
so i tried this but keep getting errors on _variant_t *p line:
****************************************************
initialize array
vector<_variant_t> d(10000);
//_variant_t** 2d = new _(variant_t*)[10000];
for(long k = 0; k < d.size(); ++k)
{
d[k] = new _variant_t();
***********************************************************
delete array
for(k = 0; k < d.size(); ++k)
{
_variant_t* p = d[k]; (error = cannot convert from 'class _variant_t' to 'class _variant_t *')
delete [] p;
}
|
|
|
|
|
hi,
use vector<_variant_t*> d(10000);
instead of
vector<_variant_t> d(10000);
|
|
|
|
|
Thanks it worked but even after compiling the code, i still get stack overflow:
this is how am declaring my array:
static const int N = 9990;<br />
static const int N2 = 96;<br />
<br />
<br />
vector<_variant_t*> d(N);<br />
<br />
<br />
for(long k = 0; k < d.size(); ++k)<br />
{<br />
d[k] = new _variant_t();<br />
}<br />
<br />
<br />
_variant_t raw_data[N][N2];<br />
<br />
_variant_t filter_results[N2];<br />
<br />
_variant_t results2[N][N2]<br />
<br />
_variant_t Filtered_Average[N];
|
|
|
|
|
you are trying to create a multidimenional array on stack. normally stack has a limitation of 2MB but heap can go upto around 100 MB.
create all the variables in heap and importantly delete it after using. this is a classic multi dimension c++ mem allocation.
sample :
_variant_t **raw_data[N];
for(int nOut = 0;nOut < N;nOut++)
{
raw_data[nOut] = new _variant_t*[N2];
for(int nIn = 0;nIn < N2;nIn++)
{
raw_data[nOut][nIn]= new _variant_t(nIn);// sample initialization
}
}
// delete this is important
for(int nOut = 0;nOut < N;nOut++)
{
for(int nIn = 0;nIn < N2;nIn++)
{
delete raw_data[nOut][nIn];
}
delete raw_data[nOut] ;
}
|
|
|
|
|
Thanks to everyone who tried to help out.
Sorry, my bad, this was a red herring.
I found out that I was overrunning an array because the spec of other parts of the software had changed without my knowledge.
I've increased the memory allocation accordingly, and it is fine now.
==================================================================
I'm having trouble with destructors and delete .
I have some embedded structure so in order to delete one of my objects, I have to call lots of desctructors in a hierarchical way:
void CMyBigClass::StartKilling()
{
if(NULL != m_pSubObject1)
{
delete m_pSubObject1;
m_pSubObject1 = NULL;
}
}
...
CSubObject1::~CSubObject1()
{
if(NULL != m_pSubObject2)
{
delete m_pSubObject2;
m_pSubObject2 = NULL;
}
}
...
CSubObject2::~CSubObject2()
{
if(NULL != m_pSubObject3)
{
delete m_pSubObject3;
m_pSubObject3 = NULL;
}
}
Normally, if I set a break point on the
delete m_pSubObject1;
line and step in (F11), I land in the first line of the desctructor fo CSubObject1.
However, I jump straight to
delete m_pSubObject3;
where I get a heap error.
I looked into as much as I could, and the debugger isn't lying. The memory it is trying to delete is different from what I told it to delete. Something is trampling over the memory, but I don't know what. I don't know how to find out either.
I've undone all the changes since the last time it was working, but still the same problem.
Please, someone, tell me how to find out what's gone wrong!!
Almost, but not quite, entirely unlike... me...
modified on Tuesday, April 6, 2010 3:16 AM
|
|
|
|
|