If you are dealing with MDI application in MFC using CMultiDocTemplate class, then I think you should use its members in this manner:
CMutiDocTemplate * t = ...; // the template for given document type
int total_documents = 0;
POSITION pos = t->GetFirstDocPosition();
while(pos != NULL)
pos = t->GetNextDoc(pos);
I am havin problems doing this c++ project.Its in regards to whether i can use one main class (e.g.main.cpp) or have to use a few classes.I am also a bit weak when it comes to c++ as java is my main language so any hints on the code or how to go about doing this would be great.The basic idea is :
Create a class called DataSet that stores a vector of floating-point values. Give this vector an initial size of zero, and use the push_back operation to add new elements.
The DataSet class should have a public member function for each of the operations described above, as well as a member function that adds an element to the vector.
I have to get the MEAN,MEDIAN and Standard Deviation.
I would very much appreciate if you could help me asap as I am desperately stuck.
It looks as though you have indeed started, and are well on your way.
iv tried but get nothing but errors.
On a side note, you might want to update your post so that it is more readable (you'll get tons more help if folks don't have to squint their eyes and turn their head sideways to make sense of it all). Use the <pre> tags to surround the code and make sure the angle brackets are formatted correctly. The Preview button helps in this capacity.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
ok sorry, im only fairly new at this.the project seems pretty basic but I just cannot do this at all.Could you give me the code or an idea on how to do this even,which would be a huge help: Create a class called DataSet that stores a vector of floating-point values. Give this vector an initial size of zero, and use the push_back operation to add new elements
I just cannot get my head around this.From the input file I have to get the Mean,Median and standard deviation.The code I have used which I took from another c++ project I have done,is incorrect i think
thanks very much,i tried something like that lastnight though id to use floating point values so used
float Vector; //Holds the floating values
int Number_of_Elements; //Holds the number of elemets -1
void Sort_Vector(); //Sorts the vector to calculate the median value
DataSet(); //Constructor of the class
~DataSet(); //Destructor of the class
void Add_Element(float float_value); //Add an element into the vector
We have 3 variables defined at file scope. The project is for a DLL that's loaded by other modules. The globals are objects that are dynamically allocated within a C++ class method using 'new'. Within the objects, more tables (arrays) are dynamically allocated using 'new'.
We're experiencing 'memory access' crashes when somehow the globals are corrupted. Its weird because the app will work fine for awhile, then get a crash. It can happen at startup, in the middle of using the app, or right before closin the app. These variables must be global and cannot be member variables of the main class. (Long story)
If the DLL is not loaded, no crash occurs. So we're confident its the DLL.
My question, is there a way to ensure that the global pointers remain intact? Or ideas on monitoring the pointers? I thought about using static in the global definition, but wasnt sure about the effect. I also thought about making the globals variables of the main looping function, but figured since I'm calling new, I wouldnt be protected by function scope memory management.
There's something at the DLL level that's screwing us up. We're desperate for a solution to ensure global pointers are not corrupt. Ideas??
When a user selects the "Preferences" menu item in my application, it triggers the method CMainFrame::OnEditPreferences() in MainFrm.cpp. At that point I create a dialog and receive input from the user. Now, I need to pass that information on the document (*Doc.cpp).
I have tried GetActiveDocument() but it does not seem to contain my custom data members; do I need to cast it to another type? And if so, what headers do I need to include? Thanks for any help.
EDIT: I solved the problem by moving the OnEditPreferences() method to the document file with the Class Wizard. Sorry for any inconvenience.