| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Organizing source code |
From: "Geo"
"John Beckett" wrote
in message news:417a21b4.28158369{at}216.144.1.254...
> I confess that I gave up on cout some time ago. I tried a couple of times
> to break my old "printf" habits,
There have been a number of exploits because people used printf, one of the
reasons I'm taking this class is so I can understand why and what the
difference is between cout and printf.
> that need cout or printf are Q&D tests, so I decided not to master all the
> weird rules of cout formatting.
cout formatting is easy, it is a bit weird and doesn't always make sense
but it's no worse than format statements in fortran.
> Lest I pollute your mind, I should point out that cout is a fantastic
> concept since you can write your own classes and provide them with methods
> to read input or write output using the standard input or output streams.
> Very elegant.
Ok now you are scaring me, you see this as elegant? I much prefer something like:
dim geo format "-%9.99"
print geo
that to me is far more elegant because it basically makes the variable a
double and says when you print it just show me 2 decimal places (used to
show dollars in many progress applications) and has very few limitations
that would create an error condition.
VC++ has a real nasty flaw in this regard because the programmer is
expected to anticipate all possible conditions. Anyone who does security
knows that's a backwards concept security wise.
> At any rate, C/C++ makes you think about exactly what you type.
Yeah I noticed, and it seems to me this will result in a lot of beta
testing errors because nobody thinks of everything.
> There is a big difference between 2 and 2.0.
and yet the computer sees (2==2.0) as true so you can't even make the
computer do simple error checking.
> Also, beware of leading zeros. For
> example, 012 is octal 12 (decimal 10).
We covered this already and I really liked it because it let me write an
oct/hex/binary/base10 conversion program that was quite short. Trying to do
that in quick basic would have caused hair loss. And that's really the way
it should be, let the machine do all the hard stuff since that's what it's
good at. Programmers shouldn't have to worry about all the conversions,
int/float/double/char, that should be done by the machine while the
programmer concentrates on flow.
> While I'm at it, here are some others:
> = is assignment while == is equality
> & is bitwise and while && is logical and
> "2" is a string while '2' is a character
> 4/5 is 0 while 4./5. is 0.8
heh, this I understand perfectly, it's why I did well on the midterm. (you
forgot ||) and shouldn't that be 4.0/5.0 instead of leaving the zero off,
just to make it easier to spot in the code (decimal points tend to be hard
to see)
Geo.
--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)SEEN-BY: 633/267 270 5030/786 @PATH: 379/45 1 396/45 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.