Using Switch with Words ??/C/C++
[1/5] from: tim::johnsons-web::com at: 1-Nov-2001 7:58
On Thu, Nov 01, 2001 at 05:31:51AM -0600, Joel Neely wrote:
>...........
FYI:
I have designed (and am teaching some)
a 4 course curriculum that is being taught
online at a local school district.
Semester 1: Intro to programming using rebol
Semester 2: Python, with tkinter and objects
Semester 3: Perl (someone else designed that)
Semester 4: C/C++
first half is using Ansi C with ABSTRACT DATA TYPES
second half is building C++ classes on top of the
abstract C data types.
Semester 4 will use examples in rebol and interfaces
to rebol. and will have as a prerequisite some
knowledge of rebol.
> Given that the same thing can be coded in C as
>
> printf "%d\n", value;
>
> it's easy to see what an improvement C++ is... ;-)
That's arguable.... :>) case-by-case basis.
I recommend reading this argument:
http://server1.florida-software.com/algorithms/cpp.shtml
> -jn-
Joel, if you don't teach you should. You would be
wonderful at it.
Tim
> ; sub REBOL {}; sub head ($) {@_[0]}
> REBOL []
<<quoted lines omitted: 5>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.johnsons-web.com
[2/5] from: joel:neely:fedex at: 1-Nov-2001 11:28
Hi, Tim,
I'll plead to a bit of stress-relief humor on this one...
Tim Johnson wrote:
> > Given that the same thing can be coded in C as
> >
> > printf "%d\n", value;
> >
> > it's easy to see what an improvement C++ is... ;-)
>
> That's arguable.... :>) case-by-case basis.
>
I was just taking a good-humored poke (at least I *HOPE* it came
across as good humor) at the fact that
> C++:
> switch(value) {
<<quoted lines omitted: 7>>
> cout << value << endl;
> }
is actually doing exactly the same thing in all cases, and is
therefore equivalent to
cout << value << endl;
(but I couldn't resist writing a C version that's exactly one
keystroke shorter! ;-)
> Joel, if you don't teach you should. You would be
> wonderful at it.
>
Thank you! Given that teaching/communicating/thinking/designing
are essentially inseparable concepts to me, I'll take that as
a compliment! (I actually have 12 years' experience teaching
Math and Computing Science in higher education, but I'm not making
my living that way now.)
-jn-
--
This sentence contradicts itself -- no actually it doesn't.
-- Doug Hofstadter
joel<dot>neely<at>fedex<dot>com
[3/5] from: arolls:idatam:au at: 2-Nov-2001 12:00
Except for the fact that you forgot the brackets!
He he :) Too much rebol, I think.
Anton.
[4/5] from: joel:neely:fedex at: 1-Nov-2001 20:00
Hi, Anton,
Ooops!
Anton Rolls wrote:
> Except for the fact that you forgot the brackets!
> He he :) Too much rebol, I think.
<<quoted lines omitted: 5>>
> > Given that the same thing can be coded in C as
> > printf "%d\n", value;
OK, then I'll make it Perl and tie for keystroke count! ;-)
printf "%d\n", $value;
-jn-
--
; sub REBOL {}; sub head ($) {@_[0]}
REBOL []
# despam: func [e] [replace replace/all e ":" "." "#" "@"]
; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"}
print head reverse despam "moc:xedef#yleen:leoj" ;
[5/5] from: dness:home at: 1-Nov-2001 21:50
Joel Neely wrote:
> Hi, Anton,
> Ooops!
<<quoted lines omitted: 15>>
> printf "%d\n", $value;
> -jn-
Not such good perl though. Try
print "$value\n";
or K's
$value
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted