|
its like procedure must be implemnt in c++
Yes. CreatiVity withOuT limiTs
|
|
|
|
|
I think he want's to port it over to C++, or maybe it's some sort of class diagram outlining functionality...
|
|
|
|
|
Do you want to convert ASCII-art into C++ code?
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]
|
|
|
|
|
yes, and without limits please.
|
|
|
|
|
#include <iostream>
using namespace std;
class A
{
private:
int x;
int y;
public:
A()
{
x = 0;
y = 0;
}
A(int First, int Second)
{
x=First;
y=Second;
}
// Opertator
// A operator= ( A &oA);
A operator- ( A oA);
A operator+ ( A oA);
A& operator++(int unu); // prefix
int GetMyX() { return x; }
int GetMyY() { return y; }
void SetMyX(int Xvalue)
{
x=Xvalue;
}
void SetMyY(int Yvalue)
{
y=Yvalue;
}
void Out()
{
cout<<"Value Of x:" << GetMyX()<<" "<<"Value Of y:"<<GetMyY()<<endl ;
}
};
A A:: operator- (A oA)
{
oA.SetMyX (oA.GetMyX ()-x);
oA.SetMyY (oA .GetMyY ()-y);
return oA;
}
A A::operator+ (A oA)
{
oA.SetMyX (oA.GetMyX ()+x);
oA.SetMyY (oA .GetMyY ()+y);
return oA;
}
A& A::operator++(int temp)
{
SetMyX (GetMyX ()+1);
SetMyY (GetMyY ()+1);
return *this;
}
int main()
{
using namespace std;
A a1(2,4);
A a2(3,6);
A a3(0,0);
a1++;
a1.Out ();
a3=a1+a2;
a3.Out ();
a3=a1-a3;
a3.Out ();
int x;
cin>>x;
return 0;
}
Yes. CreatiVity withOuT limiTs
|
|
|
|
|
Is there a question in there? It's just a bunch of code although it does look like C++ this time.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Could you at least be bothered to fix this so it is legible? Did you use the Preview button before posting?
"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
|
|
|
|
|
Hi,
It is a code for a robot i want code take vedio from usb cam and make it frams(pics) as i could use it later @ another code the code is in C++ i found one but there is a compiler error it is little but i canot fixed it
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
IplImage* src = NULL;
int _tmain(int argc, _TCHAR* argv[])
{
int key;
CvCapture* capture = NULL;
if(NULL==(capture = cvCaptureFromCAM(-1)))
{
printf("\nError on cvCaptureFromCAM");
return -1;
}
cvNamedWindow("Capture", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Capture2", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Capture", 50, 50);
cvMoveWindow("Capture2", 320, 50);
for(;;){
if(NULL==(src=cvQueryFrame(capture))){
printf("\nError on cvQueryFrame");
break;
}
cvShowImage("Capture", src);
key = cvWaitKey(10);
if(key==0x1b)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Capture");
return 0;
}
|
|
|
|
|
It's hard to tell what the problem is. Where are the "cv.h" and "highgui.h" files? Can you post the complete error message here?
|
|
|
|
|
highgui.h and cv.h are headers from the openCV[^] library.
Asmaa, if there is a compile error you will need to tell us what it is. We aren't psychic.
|
|
|
|
|
What is the compiler error? No one is going to type in your code and try to compile it.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
do you have opencv installed on your system?
if(no){install opencv;}
add opencv include and source directories to your compiler setting and at the end
add the libraries in your project setting
|
|
|
|
|
example:
double 5 cover to '5'.
|
|
|
|
|
doubles typically don't fit in one char, however you can easily convert them to string.
that is so basic, is this your first day at programming?
I hope you are wise enough to learn from a book, study it from front to where ever you get, and look at examples and exercises.
The exact answer depends on the language you use, which you did not specify.
in good old C you could do it with an sprintf() or swprintf()
Here[^] is one page of doc, even wikipedia knows how!
Please make Google your daily friend.
modified on Friday, December 11, 2009 2:51 PM
|
|
|
|
|
Sorry to say, I think you misunderstood the OP request: he wants to cover the double with a char . This is usually possible, provided the char is by repeated as needed. For instance consider the double 0.75 :
if you repeat the char '*' four times over it, then you obtain a very good coverage.
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]
|
|
|
|
|
No problem, Microsoft invented a class[^] for that very purpose.
|
|
|
|
|
Nah, (Heretic!) that's for managed development.
Furthermore, as usual, they didn't invent it, just stolen it from Java...
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 guess you probably mean convert; take a look at sprintf[^] and its variants.
|
|
|
|
|
i have an double array u[100].
this code print "Hello 123" to openGL window, can i print u like this?
static char sbuff[20];
wsprintf(sbuff,"Hello %d",123);
OutText(0,yMax - 10,sbuff,GLUT_BITMAP_8_BY_13);
void OutText(float x,float y,char *text,void *font)
{
glRasterPos2f(x,y);
for(int i=0;text[i]!=0;i++)
{
glutBitmapCharacter(font,text[i]);
}
glutPostRedisplay();
}
|
|
|
|
|
This looks good, did you have a question about it?
|
|
|
|
|
Hi folks!
Can anyone kindly tell me how to convert _variant_t to char*?
Thanks!
char Buf[100];
_variant_t var;
?
|
|
|
|
|
|
Dear Snakefoot,
Thank you very much!
I will do like this:
<br />
if (V_VT(&var) == VT_BSTR)<br />
{<br />
strcpy(Buf, (const char*)(_bstr_t)var);<br />
}<br />
I don't like to use mfc and atl(USES_CONVERSION included in afxconv.h or atlconv.h), but thank you all the same for your kindness!
|
|
|
|
|
I have an MFC dialog which is made transparent usingSetLayeredWindowAttributes().
When i start this transparent window in my machine, i can't click.
When i connect this machine remotely from any other machine and when i try to click the background of that window, i can click.
I tried with different values for alpha in SetLayeredWindowAttributes() and i found that if alpha value is equals or above 5, behavior in both cases are same.
I want to disable the clicking of background of transparent window with alpha value as 1 in remote desktop also. Or any other way for displaying the background clicking in remote desktop
Please help me.
modified on Friday, December 11, 2009 7:24 AM
|
|
|
|
|
You can check if you are in remote:
Retrieves the Remote Desktop Services session associated with a specified process.
http://msdn.microsoft.com/en-us/library/aa382990(VS.85).aspx[^]
// 0 - Not Remote Session
// 1 - Remote Session
// -1 - Internal Error
//
int isRemoteSession()
{
DWORD sessId = 0;
if(ProcessIdToSessionId(GetCurrentProcessId(), &sessId) != 0)
{
return (sessId == 0) ? 0 : 1;
}
return -1; // Internal Error
}
For the rest, eliminate the alpha when needed
|
|
|
|