From: Pascal Bourguignon <spam@mouse-potato.com>
Subject: Re: programing error
Date: Sun, 28 Aug 2005 03:01:53 +0200 [thread overview]
Message-ID: <87y86mdgce.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: 8764treyeg.fsf@wash.edu
Baloff <washdc@wash.edu> writes:
> Hello
>
> coding in C++, I have a linked list to store int, but when I store
> double it is not working and I tried to find out why but could not,
>
> thanks for looking at this problem
>
> output************************************************************
> @debian:~/Exercies/ThinkingInC++/Vol1/4thCh/7$ ./proj1
> dblStash.fetch(0) = 0
> dblStash.fetch(1) = 1
> dblStash.fetch(2) = 2
> dblStash.fetch(3) = 3
> dblStash.fetch(4) = 4
> freeing storage
> @debian:~/Exercies/ThinkingInC++/Vol1/4thCh/7$ ./proj1
> dblStash.fetch(0) = 1.6976e-313
> dblStash.fetch(1) = 1.6976e-313
> dblStash.fetch(2) = 1.6976e-313
> dblStash.fetch(3) = 1.6976e-313
> dblStash.fetch(4) = 1.6976e-313
> freeing storage
> @debian:~/Exercies/ThinkingInC++/Vol1/4thCh/7$
You need to put doubles into the list if you want to get doubles out of it!
This is the standard GIGO principle: garbage in, garbage out.
> dblStash.add(&i);
Replace with:
double d=(double)i;
dblStash.add(&d);
--
__Pascal Bourguignon__ http://www.informatimago.com/
In deep sleep hear sound,
Cat vomit hairball somewhere.
Will find in morning.
prev parent reply other threads:[~2005-08-28 1:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-27 23:46 programing error Baloff
2005-08-28 0:41 ` Barry Margolin
2005-08-28 4:53 ` Baloff
2005-08-28 1:01 ` Pascal Bourguignon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y86mdgce.fsf@thalassa.informatimago.com \
--to=spam@mouse-potato.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).