[Edu-sig] C++ As a First Language

Tim Peters tim_one@email.msn.com
Tue, 29 Feb 2000 02:18:54 -0500


[Jason L. Asbahr]
> Most readers have probably seen this already, but there is a
> fascinating interview with Stroustrup on Slashdot, in which
> Bjarne asserts that, yes, indeed, C++ *is* a great first language.
> :-)
>
> http://slashdot.org/article.pl?sid=00/02/25/1034222&mode=thread

His paper is at:

    http://www.research.att.com/~bs/new_learning.pdf

It's interesting reading, but is overwhelmingly concerned with why C++ can
be easier to teach than C, and C is really the only other language
considered.  Here's his first example:

int main()
{
    using namespace std; // gain access to standard library

    cout << "Please enter your first name:\n";
    string name;
    cin >> name;
    cout << "Hello " << name << \n;
}

While equivalent C is truly a mess (mostly because you can't know in advance
how much space to allocate for "name"), it's prophetic that this first C++
example doesn't compile:  main is declared to return int but lacks a return
stmt.  My Python version compiled the first time <wink>:

name = input("Please enter your first name:")
print "Hello", name

although-at-this-level-you-may-as-well-teach-basic-ly y'rs  - tim