|
Here's a stab in the dark:
Instead of initializing to NULL , try setting it to nullptr .
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
oh....you are right!
with nullptr it works!!! never, never used it before!
Many Thanks
Richard
|
|
|
|
|
The objective is to compare the performance of different data structures and algorithm.
The Task= in order to evaluate different ADTs an evaluation with large data must be conducted. Each ADTs should be implememted using any programming language.
choosing a dataset consist of 1000, 10,000, 50,000, 100,000, and 1,000,000 data for evaluation by using random numbers generators.
observations include (a). complexity in creating/building ADTs for the data
(b). complexity to perform insertion, deletion, and search.
the ADTs are .
conduct simple experiment to compare the performance of the different ADts.
are:
Array
Linked List
Stack
Queue
modified 10-Sep-15 16:45pm.
|
|
|
|
|
So what is the question? If the purpose is to calculate the time taken only, then consider using the clock of <ctime> header. Then calculate the time taken to complete the task, pass different number of parameters to it and see the results.
#include <iostream>
#include <ctime>
int main() {
unsigned int start = clock();
your_function(param);
std::cout << "Time taken in millisecs: " << clock()-start;
return 0;
}
This is a native way of doing so, but I would recommend that you try using the API which so ever OS you are using, for example on Windows there are many ways to get the service of a stopwatch in Win32 or even better in Visual C++'s .NET implementation.
Above code from: http://cboard.cprogramming.com/cplusplus-programming/97572-how-do-stopwatch-cplusplus-program.html[^]
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
thanks. but its not just about the time taken only. i updated the questions. please do check again and give me your idea. its killing me here. am confused
|
|
|
|
|
What do you mean with ADT?
|
|
|
|
|
Presumably, abstract data type.
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I believe you are right, however I wonder how could you measure the performance of an abstract data type?
|
|
|
|
|
CPallini wrote: I wonder how could you measure the performance of an abstract data type?
Reading it seemed pretty obvious to me that point it to measure the performance of the data structures when they contain the ADTs with the given functional methods
|
|
|
|
|
See #11 here.
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Member 11975120 wrote: The objective is
Solution:
1 - Write a ADT
2 - Create method to populate ADT with random data using a fixed seed.
3 - Write data structures.
4- Write method that creates number of ADTs and creates data structure with number given
5- Write method that inserts, searches and deletes a single newly create ADT
6- Make sure all of that works
7- Add timing to 5 and write times out
|
|
|
|
|
Good afternoon friends. Please how do I make this program quoted the following link function in the virtualbox, for example I downloaded the tutorial and no disk image or anything. Please for I am beginner and I am interested in the subject of freestanding but do not find anything on the web. If someone can help me thank you or not. Already Obrigadoe God Bless ...
|
|
|
|
|
Which link are you referring to? If it is from a CodeProject article then please use the forum at the end of the article.
|
|
|
|
|
Good Night, and Deculpa Friend, forgot the link but here goes: http: //www.codeproject.com/Articles/36907/How-to-develop-your-own-Boot-Loader
|
|
|
|
|
OK, so post your question in the forum below the article.
|
|
|
|
|
Member 11940289 wrote: Please how do I make this program quoted the following link...Please for I am beginner That article is somewhat involved and would not be my first choice for a beginner. Why not start with something a little less aggressive?
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Good night friends. Sorry if I sound a bit rushed, but that is for me (especially) is very important to know does. And since someone there on the other side has the answer to my doubts, Please me of this force, since I am also not starting there, and yes seeing the two modes in parallel. Already Thank you and God Bless ...
|
|
|
|
|
Hi all,
I have spend already many hours to find the reason of my current problem.
I have a CDockablePane, in which I am placing a lot of CStatic controls. The CStatic controls I am using to display bitmaps. A dockable pane is designed for resizing at any time. Therefore I try to recalculate the positions of each CStatic after OnSize is called.
With some CStatic controls it is running well. But when I am adding an additional control, I am getting strange problems: The pane is not repainted properly and OnPaint is recalled cyclically.
My code (partially):
Header:
class CPaneCtrlPLC : public CDockablePane
{
DECLARE_DYNAMIC(CPaneCtrlPLC)
public:
CPaneCtrlPLC();
virtual ~CPaneCtrlPLC();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
private:
CStatic m_Ctrl_PLCLED[6];
CStatic m_SwitchCtrl;
CStatic m_Ctrl_test;
C-File:
int CPaneCtrlPLC::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
m_ColorSieGreen = RGB(0, 153, 153);
m_ColorSieWhite = RGB(251, 253, 253);
m_ColorText = RGB(230, 228, 193);
m_ColorBgnd = RGB(119, 117, 127);
m_BrushSieGreen.CreateSolidBrush(m_ColorSieGreen);
m_BrushBgnd.CreateSolidBrush(m_ColorBgnd);
m_BitmapSWITCHSTOP.LoadBitmapW(IDB_SWITCH_STOP);
m_bitmapLEDOFF.LoadBitmapW(IDB_LEDOFF);
m_bitmapLEDRED.LoadBitmapW(IDB_LEDRED);
m_bitmapLEDGREEN.LoadBitmapW(IDB_LEDGREEN);
m_bitmapTest.LoadBitmapW(IDB_LEDGREEN);
DWORD dwStyle = WS_CHILD | WS_VISIBLE | TVS_SHOWSELALWAYS | SS_BITMAP;
m_SwitchCtrl.Create(NULL, dwStyle, CRect(0, 0,0,0),this);
m_SwitchCtrl.SetBitmap(m_BitmapSWITCHSTOP);
int iLed;
for (iLed = 0; iLed < MaxNumPLCLeds; ++iLed)
{
DWORD dwStyle = WS_CHILD | WS_VISIBLE | TVS_SHOWSELALWAYS | SS_BITMAP;
m_Ctrl_PLCLED[iLed].Create(NULL, dwStyle, CRect(xPosPLCLEDS,(yPosPLCLEDS + (26* iLed)), 0, 0), this);
m_Ctrl_PLCLED[iLed].SetBitmap(m_bitmapLEDOFF);
}
{
DWORD dwStyle = WS_CHILD | WS_VISIBLE | TVS_SHOWSELALWAYS | SS_BITMAP;
m_Ctrl_test.Create(NULL, dwStyle, CRect(xPosPLCLEDS + (17 * iLed), yPosPAELEDS + 20, 0, 0), this);
m_Ctrl_test.SetBitmap(m_bitmapTest);
}
...
I was able to strip the OnPaint(0) function to a minumum to reprocude the problem.
If I comment out the re-positioning of the m_Ctrl_test, everything works fine, but with this statement I have the problems.
void CPaneCtrlPLC::OnPaint()
{
LOGMSG(LOG_TEST, _T("Repaint"));
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
dc.FillRect(&rect, &m_BrushBgnd);
m_SwitchCtrl.SetWindowPos(NULL, 10,10, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOCOPYBITS);
m_Ctrl_test.SetWindowPos(NULL, 10, 100, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOCOPYBITS);
return;
}
Any ideas, what could be wrong?
|
|
|
|
|
Solved by myself!
In OnPaint() I changed the positions of the CStaticControls.
Of course this is causing "recursive" WM_PAINT calls.
I moved this code to other functions (OnSize, OnTimer,...), now it works!
|
|
|
|
|
I have a CListCtrl in my MFC dialog application.
I enabled the HDS_FILTERBAR for List control the by the following code.
CHeaderCtrl* pHeaderCtrl = m_myListCtrl.GetHeaderCtrl();
pHeaderCtrl->SetDlgCtrlID( IDC_LIST1 );
HDITEM hdItem;
ZeroMemory( &hdItem, sizeof( HDITEM ));
hdItem.mask = ( HDI_FILTER );
pHeaderCtrl->ModifyStyle( 0, HDS_FILTERBAR );
hdItem.type = HDFT_ISSTRING;
The filter is displayed.
However I would like to change the background color and font of the Edit control and button in the filter section.
How can I achieve it.
aks
|
|
|
|
|
The CEdit class inherits from CWnd so you can use SetFont to change the font. You can probably set the background colour by subclassing the window. Changing the colour and image in a button can be done in similar ways. Google should find you some samples.
|
|
|
|
|
Thank you for the comment.
I tried by subclassing the Header control.
But I could not find any options to get the edit control and button from the CHeaderCtrl.
aks
|
|
|
|
|
aks. wrote: I could not find any options to get the edit control and button So who put them in the header in the first place?
|
|
|
|
|
Ok. I got it, I used FindWindoEx to find the WC_EDIT in the header.
I think the filter button is not exactly a button. Its a bitmap.
aks
|
|
|
|
|
I don't think that is the best way. You put the items in the header so you should be able to get their handles quite easily using the methods of the CHeaderCtl object.
|
|
|
|