|
Thanks Ernest,
but can I ask, how would one
convert a string to long double?
Would I need to use atof(), then
use a static cast to ld? I would
think there is a direct method.
Thanks for your help.
David
|
|
|
|
|
according to MS document, long double is equal to double. and atof() will convert a string to double. I think this is what you want for the assignment?
|
|
|
|
|
atof function does return a double value.
Try this ...
#include <stdlib.h>
#include <stdio.h>
#include <isostream.h>
using namespace std;
int main()
{
char str1[] = "123.21";
double d = atof(str1);
cout << d;
return 0;
}
|
|
|
|
|
thanks all. Very much appreciated.
|
|
|
|
|
does anyone knows how to use ScrollWindowEx?
c++ : my dream
|
|
|
|
|
Nope..no one uses ScrollWindowEx anymore...
I'm afraid your going to have to be more specific than that...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I want to use the ScrollWindowEx to animate window, when scrolling.
i mean I can't use ScrollwindowEx do the same thing that scrollwindow do, if i change the last parameter to SW_SMOOTHSCROLL. it can't update the region scrolled.why not have a try? you can test the following code inyou application.
...
CRect rcClient;
GetClientRect(&rcClient);
ScrollwindowEx(100,0, &rcClient, &rcClient, NULL,NULL, SW_SMOOTHSCROLL);
...
c++ : my dream
|
|
|
|
|
Hi all,
This is my first post; I'm new to C++ so go easy on me.
I have two classes; and their functions include code that refer to the other:
i.e: Class X has code that uses a variable/function from Class Y and vice-versa. The classes are completely different, so it would not help to derive one off the other.
In Header.h:
------------------------------------------------------------
class X {
public:
int myint;
void doit(void);
};
void X::doit(void) {
printf("CY.myint = %i", CY.myint);
}
class Y {
public:
int myint;
void doit(void);
};
void Y::doit(void) {
printf("CX.myint = %i", CX.myint);
}
------------------------------------------------------------
In Main.CPP:
------------------------------------------------------------
#include "stdio.h"
#include "Header.h"
int main(void) {
class X CX;
class Y CY;
CX.myint = 100;
CY.myint = 200;
CX.doit();
CY.doit();
return 1;
}
------------------------------------------------------------
How can I get these classes to work together?
I can't put an 'extern class Y' before the 'class X' declaration, so how can I let the compiler know that the other class exists and will be declared?
Thanks!
Mike
|
|
|
|
|
Xds wrote:
int main(void)
{
class X CX;
class Y CY;
CX.myint = 100;
CY.myint = 200;
CX.doit();
CY.doit();
return 1;
}
I'm not sure about this but isn't it "wrong" to write 'class X CX'?
Isn't 'X CX' the right way!?
I can be wrong!!!!!!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Pretty sure it works either way, but in any case, that's not the problem.
Thanks!
Mike
|
|
|
|
|
You need to use a forward declaration of the class.
class Y ;
class X
{
void DoIt(Y& y) ;
} ;
class Y
{
} ;
You also cannot print out the content of CY in CX unless you pass a reference / pointer / copy of the object you want to print in as a parameter. The CX in main does not know anything about the CY:
#include "stdio.h"
#include "Header.h"
int main(void)
{
X CX;
Y CY;
CX.myint = 100;
CY.myint = 200;
CX.doit(CY);
CY.doit();
return 1;
}
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
That code wont't compile because in your doit methods you reference hard-coded instances.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
Do you know an activex control able to show .gif files?
rechi
|
|
|
|
|
first, you need a GIF/LZW license. see www.unisys.com.
-c
"What the hell are you getting so upset about? I thought you didn't believe in God".
"I don't," she sobbed, bursting violently into tears, "but the God I don't believe in is a good God, a just God, a merciful God. He's not the mean and stupid God you make Him out to be".
-- Joseph Heller
Smaller Animals Software, Inc.
|
|
|
|
|
Use image.ocx...
Regards...
A couple of month agou in MSDN magazine, Paul Dilascia wrote a class for display those type of files....
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I'm pretty sure there is an article here on CP about that!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Thank you all, the problem is now solved!
Thanks1
rechi
|
|
|
|
|
hi,
I want the arabic character writing in the Edit Text and Static Text in the English Windows (No Arabic Windows) . Arabic fonts is best writing but it is wrong connect the arabic character.. (in the MFC od Embedded VC++)..
I'm not good speak englih.. Sorry all!
Please help me.
best regads..
Mesut
mgencer99@hotmail.com
MFC
|
|
|
|
|
You need to use Unicode Strings, and need to work in a PC with that language. Never but never save the project in a pc, with another idiom.
I worked in a multy language project, And I nedded to save same parts of the project in OS that supports that languajes, like Arabic, Hebrew and Russian...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
You need to set the RTL proprti in the Edit and in the static controls, the same for the combo boxes
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Dose anybody know where I can find demonstration packages programmed in Visual c++, which show you the encryption of eg transposition cipher. I can find alot of help in Java but sadly none in Visual c++
Any suggestions? urls? Or people I can e-mail?
thanks
|
|
|
|
|
I am well and truely stumped. I have created a progress bar within a formview and I am trying to access it via a totally different class and getting all sort of errors.
Here is the code: -
percentage=int(((float)i/(float)(mrecords*4))*100.0);
str.Format("Mailsort is %d%% complete (Coding - %s)", percentage, currentmailsortfile);
m_progress.SetWindowText(str);
m_progress.SetPos(percentage);
and the progress control is created in the IYIView.h header file as follows: -
//{{AFX_DATA(CIYIView) enum { IDD = IDD_IYI_FORM };
CTextProgressCtrl m_progress;
//}}AFX_DATA
I am trying to access the view header file (IYIView.h) in order to create an instance of the class and access the progress control (m_progress) but I am getting the following errors on compliation but don't know how to get round it without effecting the rest of the program.
d:\my projects\iyi\iyiview.h(23) : error C2065: 'IDD_IYI_FORM' : undeclared identifierd:\my projects\iyi\iyiview.h(23) : error C2057: expected constant expression
d:\my projects\iyi\iyiview.h(115) : error C2143: syntax error : missing ';' before '*'
d:\my projects\iyi\iyiview.h(115) : error C2501: 'CIYIDoc' : missing storage-class or type specifiers
d:\my projects\iyi\iyiview.h(115) : error C2501: 'GetDocument' : missing storage-class or type specifiers
MSDN is no help, so do you have any ideas?!?
|
|
|
|
|
Check this.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I don't need to access the whole view but simply the progress bar to update from a different class. Is it really necessary to do all of this code just to pass a value to a control?
|
|
|
|
|
James P wrote:
Is it really necessary to do all of this code just to pass a value to a control?
If you wanna use your view you have to do something like that.There are another way exist but I didn't test.Read the messages at the bottom of that article,they are easier.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|