Mail Archives: djgpp/1998/09/02/09:00:32
From: | morgado AT mail DOT telepac DOT pt (Jorge Bruno S. S. Morgado)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | help - type conversion
|
Date: | Wed, 02 Sep 1998 11:53:55 GMT
|
Lines: | 46
|
Message-ID: | <35ed2f07.8501652@news.telepac.pt>
|
NNTP-Posting-Host: | 194.65.175.163
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
How do I convert some type of data that I have created to a standard
data type of c++ ?
For example, I have created a class complex, that is something like
this:
class complex
{
protected:
double real;
double imag;
public:
...
...
}
Now, in the main I have:
main()
{
complex x;
complex y;
x = (10, 4);
y = (43, 45);
/* And now, I want x to be a double, I do not want x to be something
like 2.2 + 0i, I want it ti be just a double 2.2, like this: */
x = 2.2;
}
Is it possible to do this, how can I do it ?
P.S. - If you post an message to the group, please send me also an
e-mail.
Tanks
__________________________________________________________
Jorge Bruno S. S. Morgado,
Student of astronomy at Faculdade de Ciênçias do Porto, Portugal,
email: morgado AT mail DOT telepac DOT pt
- Raw text -