|
First off, thanks for the reply. Now to the code. This is the actual code i should have posted earlier, this is the actual full code:
I am not sure what you mean by not being able to see whats between the <> and the brackets themselves? what am i doing wring?
#include "stdlib.h"
#include "stdio.h"
#include "Sphere.h"
#include <list>
extern std::list<sphere>list_of_classes;
extern std::list<sphere>::const_iterator iterator;
#include <list>
class sphere{
public:
int id;
int promjer;
int x;
int y;
sphere(int idd, int ppromj, int xx, int yy, std::list<sphere> *llist_of_classes) : id(idd), promjer(ppromj), x(xx), y(yy){
llist_of_classes.push_back(this);
};
};
#include "sphere.h"
#include "util.h"
std::list<sphere>list_of_classes;
std::list<sphere>::const_iterator iterator;
void main(){
sphere objekt(1,2,3,4,&list_of_classes);
for(iterator=list_of_classes.begin(); iterator!=list_of_classes.end(); ++iterator)
{
printf("kugla:%d, promjer: %d, x: %d, y: %d\n",iterator->id, iterator->promjer, iterator->x, iterator->y);
}
getchar();
}
this code generates C2228:left of '.push_back' must have class/struct/union <-3times
This is the entire literal code.
All i need is a way to correctly pass a pointer to the list, add the newly created sphere object in its constructor into the list, and thats it!
Anyone spot the problem?
thank you!
|
|
|
|
|
Avion85 wrote: I am not sure what you mean by not being able to see whats between the <> and the brackets themselves? what am i doing wring?
You need to escape the < by replacing it with < - easiest way is to tick the 'Encode HTML tags when pasting' checkbox below the Text: field when pasting code into a message.
As to your problem...
llist_of_classes.push_back(this);
llist_of_classes is a pointer, not a reference or a value. So, the dot operator won't work with it - use the -> operator!
llist_of_classes->push_back(this);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you all for the solution! it finally works, and this is it:
sphere(int idd, int ppromj, int xx, int yy, std::list<sphere> *llist_of_classes) : id(idd), promjer(ppromj), x(xx), y(yy){
llist_of_classes->push_back(*this);
}
sphere objekt(1,2,3,4,&list_of_classes);
This forum is awesome.A fact.
|
|
|
|
|
Hi,
How to register a window of Dialog Based Application?
|
|
|
|
|
|
U can do the registration in 'InitInstance' method of Application derived class(before 'DoModal' of the main dialog)
WNDCLASS wc = {0};
wc.style = CS_BYTEALIGNWINDOW|CS_SAVEBITS|CS_DBLCLKS;
wc.lpfnWndProc = DefDlgProc;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = m_hInstance;
wc.hIcon = LoadIcon(IDR_MAINFRAME);
wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
wc.lpszClassName = <Specify the class name here as well as in .rc>
ATOM cls = RegisterClass(&wc);
|
|
|
|
|
i need help for code for fast algorithm to compute Walsh Hadamard coefficient
|
|
|
|
|
What is your trouble with?
What have you done, so far?
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 have problem in calculation of value
w(k+1,b)=(w(k,b)+w(k+1,2b),w(k,b),w(k+1,2b))
how i write this in C
|
|
|
|
|
ahmedbhatti wrote: w(k+1,b)=(w(k,b)+w(k+1,2b),w(k,b),w(k+1,2b))
It strongly depends on the meaning of such expression, I suppose...
I.e. what is w(k,b) ? What is (w(..),w(..),w(..)) ?
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]
|
|
|
|
|
Assalamo 3aliko
I need c++ program for OFDM techniques in WIMAX system
pleas if any one have it send it for me
thanks a lot
|
|
|
|
|
rent-a-coder looks like a viable solution.
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]
|
|
|
|
|
How to execute inf files from C++ code. My Device Driver are having .inf file with some other file. I want to execute inf file for installing Device Driver.
|
|
|
|
|
See ShellExecute[^] with 'verb' set to 'open'
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You can execute a particular section in an INF file using the InstallHinfSection function.
See the documentation of InstallHinfSection[^] for more information.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hello to all,
In my project I am uploading some data on to the internet.After data uploading gets completed without any problem then one modal dialog box appears showing the text "Uploaded Successfully" (I am invoking that dialog box through "AfxMessageBox"). Now I want to play one "avi" file on to that dialog box or I want to show some moving image on to that dialog box. So anyone knows how to do it? anyone knows how to play "avi" file on modal dialog box? its really urgent so plz help me out.
Thanks and Regards,
Anay
|
|
|
|
|
|
For show avi files you can see Nuri Ismail's answer although you can use of MCI functions,for moving images you can make a timer and then you can move images.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
hai friend's
I want to Communicate with Ms Access using MFC Application , I don't Know Ms Access...
But Am Working in SQL with MFC
Please Help Me How to Insert ,Delete ,Update in Ms access...give some code plz thank u... Regard'sMathy's
|
|
|
|
|
|
|
Hi All
Can i set or use Check box on messageBox?Plz advice me
|
|
|
|
|
|
Hi,
How can send a message to a running application from another running application.
I tried with FindWindow(), to find the window and PostMessage() to it.
But somtimes FindWindow() is not able to figure out the desired window.
I think I have to use the registred class name instead of Window Name...
So please tell me how to do that..
My app is SDI(VS 2003). And window registration code is
<br />
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
if( !CFrameWnd::PreCreateWindow(cs) )<br />
return FALSE;<br />
<br />
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;<br />
cs.lpszClass = AfxRegisterWndClass(NULL,NULL,NULL,AfxGetApp()->LoadIcon(IDR_MAINFRAME));<br />
cs.style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;<br />
return TRUE;<br />
}<br />
<br />
But the AfxRegisterWndClass() return a window name that is like afx:0000:50000......
Is there any way to register the window with user defind name so that I can use this name with FindWindow().
|
|
|
|
|
You can use of EnumWindows it gives you a handle to each window and then you can use of ::SendMessage(hwnd,....);
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|