C++, a good starting language?

Discussion in 'C++' started by Omar Radwan, May 23, 2014.

  1. Omar Radwan

    Omar Radwan Guest

    I am currently learning C++, from this book http://www.amazon.com/Beginning-C-T...00802533&sr=8-1&keywords=Game+programming+C++ and I am so far on the 200th page. Half way through. The problem is though, I still don't know howto write code in C++, I would have expected to be able to by the half-bookmark. This is my first language, I totally understand the material that istill the 200th page (functions, I/O, arthemitc operators, variables, constants, enumerations, loops, if/else, switch-case, arrays, functions, and refrences), so I also know the concept. But I don't know how to "code" yet. I don't want to become a game programmer. I want to become a system programmer, like in Unix, BSD, and Linux and stuff like that. The reason that I chose C++ is that because it's extremely powerful, low-level like C, and has high level things too, like classes and objects. Am I going through the rightpath? Or should I switch? Do you guys have any idea what I should do?
     
    Omar Radwan, May 23, 2014
    #1
    1. Advertisements

  2. Omar Radwan

    Stefan Ram Guest

    Omar Radwan <> writes:
    >and I am so far on the 200th page.


    So, you are on page number 199.

    >problem is though, I still don't know how to write code in
    >C++


    »int main(){}«.

    >I would have expected to be able to by the half-book
    >mark.


    I suggest to read this web page:

    »Teach Yourself Programming in Ten Years - Peter Norvig«

    >This is my first language, I totally understand the
    >material that is till the 200th page (functions, I/O,
    >arthemitc operators, variables, constants, enumerations,


    If you »totally understand« it, then let us know what
    your definition of »variable« is.
     
    Stefan Ram, May 23, 2014
    #2
    1. Advertisements

  3. Omar Radwan

    Stefan Ram Guest

    Omar Radwan <> writes:
    >I want to become a system programmer, like in Unix, BSD, and Linux


    Linus Torvalds:

    »C++ is a horrible language. It's made more horrible by
    the fact that a lot of substandard programmers use it (...)

    I've come to the conclusion that any programmer that would
    prefer the project to be in C++ over C is likely a
    programmer that I really *would* prefer to [move on], so
    that he doesn't come and [disturb] any project I'm involved
    with. (...)«

    http://lwn.net/Articles/249460/
     
    Stefan Ram, May 23, 2014
    #3
  4. Omar Radwan

    Omar Radwan Guest

    On Thursday, May 22, 2014 4:56:00 PM UTC-7, Omar Radwan wrote:
    > I am currently learning C++, from this book http://www.amazon.com/Beginning-C-T...00802533&sr=8-1&keywords=Game+programming+C++ and I am so far on the 200th page. Half way through. The problem is though, I still don't know how to write code in C++, I would have expected to be able to by the half-book mark. This is my first language, I totally understand the material that is till the 200th page (functions, I/O, arthemitc operators, variables, constants, enumerations, loops, if/else, switch-case, arrays, functions, and refrences), so I also know the concept. But I don't know how to "code" yet. I don't want to become a game programmer. I want to become a system programmer, like in Unix, BSD, and Linux and stuff like that. The reason that I chose C++ is that because it's extremely powerful, low-level like C, and has high level things too, like classes and objects. Am I going through the right path? Or should I switch? Do you guys have any idea what I should do?


    Ok, maybe I wasn't clear enough, by writing code, I meant to be able to write a text editor, or a terminal web browser, or an ftp or http ot tcp server or client. But I did write a Pi calculator program which can calculate about 10 different shapes involving Pi
     
    Omar Radwan, May 23, 2014
    #4
  5. Omar Radwan

    Stefan Ram Guest

    Omar Radwan <> writes:
    >Ok, maybe I wasn't clear enough, by writing code, I meant to
    >be able to write a text editor


    My take at a text editor in C++ (I do not yet have ::std::stoi):

    #include <iostream>
    #include <cstdlib>

    int main()
    { ::std::cout << "i1 insert \"1\"\n+1 move cursor right\n-1 "
    " move cursor left\nd1 delete 1 character\n";
    ::std::string s{ "alpha" }, c; int pos = 0; do
    { ::std::cout << s << '\n' << ::std::string( pos, ' ' ) << '^' << '\n';
    ::std::cin >> c; switch( c.at( 0 ))
    { case 'i': s.insert( pos, c.substr( 1 )); break;
    case '+': pos += atoi( c.substr( 1 ).c_str() ); break;
    case '-': pos -= atoi( c.substr( 1 ).c_str() ); break;
    case 'd': s.erase( pos, atoi( c.substr( 1 ).c_str() )); break; }} while( 1 ); }
     
    Stefan Ram, May 23, 2014
    #5
  6. Omar Radwan

    Guest

    On Thursday, May 22, 2014 11:56:00 PM UTC, Omar Radwan wrote:
    > I am currently learning C++, from this book http://www.amazon.com/Beginning-C-T...00802533&sr=8-1&keywords=Game+programming+C++ and I am so far on the 200th page. Half way through. The problem is though, I still don't know how to write code in C++, I would have expected to be able to by the half-book mark. This is my first language, I totally understand the material that is till the 200th page (functions, I/O, arthemitc operators, variables, constants, enumerations, loops, if/else, switch-case, arrays, functions, and refrences), so I also know the concept. But I don't know how to "code" yet. I don't want to become a game programmer. I want to become a system programmer, like in Unix, BSD, and Linux and stuff like that. The reason that I chose C++ is that because it's extremely powerful, low-level like C, and has high level things too, like classes and objects. Am I going through the right path? Or should I switch?


    > Do you guys have any idea what I should do?


    Not really, but you could do worse than C++.
    Java sucks and I don't like Perl either.
    I suggest starting a company. When you have some
    free time, work on the company. The company can become
    a foundation for your future; a vehicle that can
    help you with taxes and such. You don't have to
    start a company this year, but don't put it off
    too long.


    Brian
    Ebenezer Enterprises - Heavenly code.
    http://webEbenezer.net
     
    , May 23, 2014
    #6
  7. Omar Radwan

    Öö Tiib Guest

    On Friday, 23 May 2014 03:19:46 UTC+3, Omar Radwan wrote:
    > Ok, maybe I wasn't clear enough, by writing code, I meant to be able
    > to write a text editor, or a terminal web browser, or an ftp or http
    > ot tcp server or client. But I did write a Pi calculator program which
    > can calculate about 10 different shapes involving Pi


    Calm down, no one becomes brain surgeon or system programmer after
    reading 200 pages. It takes years to learn of doing things properly.

    Take Python as first language for to trying things out quickly. Or maybe
    take Scheme that is one of the most minimalist programming languages.
    Later you can learn C++ or Java.

    Web browsers like Firefox or Chrome contain millions of lines of C++.
    Do not aim to make such huge things that take years of effort from
    big teams of engineers.
     
    Öö Tiib, May 23, 2014
    #7
  8. Omar Radwan

    Omar Radwan Guest

    So you guys think I should learn C instead?
     
    Omar Radwan, May 23, 2014
    #8
  9. Omar Radwan

    Jorgen Grahn Guest

    On Fri, 2014-05-23, Stefan Ram wrote:
    > Omar Radwan <> writes:
    >>I want to become a system programmer, like in Unix, BSD, and Linux

    >
    > Linus Torvalds:
    >
    > »C++ is a horrible language. It's made more horrible by
    > the fact that a lot of substandard programmers use it (...)


    If you agree with that, why are you here? Trolling?
    Or did I miss your point?

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, May 23, 2014
    #9
  10. Omar Radwan

    Jorgen Grahn Guest

    On Fri, 2014-05-23, Omar Radwan wrote:
    > So you guys think I should learn C instead?


    Based on what you said you wanted: no!

    I want to become a system programmer, like in Unix, BSD, and Linux
    and stuff like that. The reason that I chose C++ is that because
    it's extremely powerful, low-level like C, and has high level
    things too, like classes and objects.

    You can do Unix systems programming easier and better with C++. You
    just need to be aware that in existing code, C is much more common,
    and a lot of C programmers are prejudiced against C++. Also in my
    experience it's easier to get a job doing C programming.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, May 23, 2014
    #10
  11. The answer is, it depends. For me, I learnt a bit of visual basic and logo in
    school (this is when I was a kid in 7th grade or so) which taught be a bit about
    variables and other basic concepts (loops, statements). But this stuff can be
    understood very easily if encountered the first time in C++ too. Apart from
    that, I started learning C++ in 11th grade, and then 12th. In that time, I
    learnt all about structures, functions, OOP, templates and other advanced
    concepts very easily. It helps if you have a good book.

    As far as a starting book is concerned, your game programming one is not ideal
    in my opinion. I think you should start with _C++ Primer_ (get the latest fifth
    edition).

    NOTE : Not to be confused with C++ Primer Plus, which is not as good.

    C++ Primer is a very good book and has been updated for the latest C++11
    standard. It teaches all the basic concepts and does not assume knowledge of C
    in the reader (although it will not hold your hand for the fundamentals, like
    what are variables, functions etc. but from your post, I think you already
    understand these).

    Buy this book from
    http://www.amazon.com/Primer-5th-Edition-Stanley-Lippman/dp/0321714113 and also
    go through this list of c++ books on stackoverflow
    http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

    Good luck, and if you have any further questions, email me at
    or post in this group.

    P.S - If you can not afford the book, email me and I will send you a pdf version
    (although I can afford my books now, I was not able to for a long time, and
    learned to program by torrenting books (though I bought them all later) so I can
    understand if you want the pdf)
     
    Aditya Raj Bhatt, May 23, 2014
    #11
  12. Omar Radwan

    Jorgen Grahn Guest

    On Fri, 2014-05-23, Öö Tiib wrote:
    > On Friday, 23 May 2014 03:19:46 UTC+3, Omar Radwan wrote:
    >> Ok, maybe I wasn't clear enough, by writing code, I meant to be able
    >> to write a text editor, or a terminal web browser, or an ftp or http
    >> ot tcp server or client. But I did write a Pi calculator program which
    >> can calculate about 10 different shapes involving Pi

    >
    > Calm down, no one becomes brain surgeon or system programmer after
    > reading 200 pages. It takes years to learn of doing things properly.
    >
    > Take Python as first language for to trying things out quickly. Or maybe
    > take Scheme that is one of the most minimalist programming languages.
    > Later you can learn C++ or Java.


    I think he can start with C++.

    > Web browsers like Firefox or Chrome contain millions of lines of C++.
    > Do not aim to make such huge things that take years of effort from
    > big teams of engineers.


    True. But it needs to be pointed out that C++ isn't just for monsters
    like those. Specifically, anything that's worth doing in C can be
    done better in C++.

    OP: since you're on Linux I recommend reimplementing some of the simpler
    Unix commands: ls, sort, uniq, ... Don't bother with all the options
    at first.

    Another option is to study and modify some existing, good C++ program.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, May 23, 2014
    #12
  13. Omar Radwan

    Öö Tiib Guest

    On Friday, 23 May 2014 10:10:30 UTC+3, Jorgen Grahn wrote:
    > On Fri, 2014-05-23, Stefan Ram wrote:
    > > Omar Radwan <> writes:
    > >>I want to become a system programmer, like in Unix, BSD, and Linux

    > >
    > > Linus Torvalds:
    > >
    > > �C++ is a horrible language. It's made more horrible by
    > > the fact that a lot of substandard programmers use it (...)

    >
    > If you agree with that, why are you here? Trolling?
    > Or did I miss your point?


    The point was perhaps humorous coincidence of situation:
    * OP describes himself as extremely substandard programmer.
    * OP wants to do system programming in C++ on Linux.
    * Linux is crown-child of Linus Torvalds.
    * Linus Torwalds is militant against C++ for the very reason above.

    :D

    Otherwise it is outright irrational stance because programmers
    thought can not be someway "squeezed into a cage" of vocabulary
    and grammar of programming language that they use. No one does
    literally think in C++ or C or Java so what they talk about are some
    conveniences, complexities or hidden costs of expressing particular
    designs in particular ways. IOW minor issues on general case.
     
    Öö Tiib, May 23, 2014
    #13
  14. Omar Radwan

    Stefan Ram Guest

    Aditya Raj Bhatt <> writes:
    >that, I started learning C++ in 11th grade, and then 12th. In that time, I
    >learnt all about structures, functions, OOP, templates and other advanced


    I you »learnt all about« »OOP«, then answer these questions:

    Who coined the term OOP, and what was his definition of OOP?
     
    Stefan Ram, May 23, 2014
    #14
  15. Omar Radwan

    Stefan Ram Guest

    d (Drew Lawson) writes:
    >I am biased by the path I have followed. Personally, I think it
    >is better to first learn to program with something simple -- C,
    >Pascal, BASIC -- to get the core concepts. That view is not dominant


    Pascal, BASIC, and C are all simpler than C++, but C is more
    close to today's popular languages.

    BASIC is less clearly specified (which specification exactly does
    »BASIC« refer to?) and less well supported on modern operating
    systems. Pascal is more clearly specified (one still has a choice
    among several versions), but also less supported today.

    C has the unique feature that very often its calling convention
    also is the OS' ABI.
     
    Stefan Ram, May 23, 2014
    #15
  16. Omar Radwan

    Stefan Ram Guest

    Jorgen Grahn <> writes:
    >On Fri, 2014-05-23, Stefan Ram wrote:
    >>Omar Radwan <> writes:
    >>>I want to become a system programmer, like in Unix, BSD, and Linux

    >>Linus Torvalds:
    >>»C++ is a horrible language. It's made more horrible by
    >>the fact that a lot of substandard programmers use it (...)

    >If you agree with that, why are you here?


    Maybe you have misunderstood the name »comp.lang.c++«:
    It does not mean it's a newsgroups for /C++ advocates/,
    it is a newsgroup for /discussions about C++/.

    (Moreover, I have not written that I agree with that.)
     
    Stefan Ram, May 23, 2014
    #16
  17. On Friday, 23 May 2014 21:47:12 UTC+5:30, Stefan Ram wrote:
    > Aditya Raj Bhatt <> writes:
    >
    > >that, I started learning C++ in 11th grade, and then 12th. In that time,I

    >
    > >learnt all about structures, functions, OOP, templates and other advanced

    >
    >
    >
    > I you �learnt all about� �OOP�, then answer these questions:
    >
    >
    >
    > Who coined the term OOP, and what was his definition of OOP?


    Please do not test me like this, I know about Alan Kay's definition of OOP (he
    was the one who coined it) and the distinctly different implementation of it in
    Smalltalk (as opposed to C++). No, I do not claim to know smalltalk (apart from
    some toy programs to see what message passing was all about). I know about Alan Kay's different definitions only because I waste a lot of my time trawling
    through programming blogs online. Right now, I am trying my hand at lisp and
    know only high-school level C++ properly (I'm 17, by the way).

    So I probably will not be able to answer any detailed questions you may ask
    me.
     
    Aditya Raj Bhatt, May 23, 2014
    #17
  18. Omar Radwan

    Stefan Ram Guest

    Aditya Raj Bhatt <> writes:
    >Please do not test me like this


    When someone says he knows »all about« something, I sometimes
    cannot resists the temptation to try to learn something from him.

    >through programming blogs online. Right now, I am trying my hand at lisp and
    >know only high-school level C++ properly (I'm 17, by the way).


    When I wrote my first LISP programs I must have had the same
    age. Gradually, today, all other programming languages try
    to incorporate some parts of what LISP already had had many
    decades ago.
     
    Stefan Ram, May 23, 2014
    #18
  19. Omar Radwan

    Jorgen Grahn Guest

    On Fri, 2014-05-23, Stefan Ram wrote:
    > Jorgen Grahn <> writes:
    >>On Fri, 2014-05-23, Stefan Ram wrote:
    >>>Omar Radwan <> writes:
    >>>>I want to become a system programmer, like in Unix, BSD, and Linux
    >>>Linus Torvalds:
    >>>»C++ is a horrible language. It's made more horrible by
    >>>the fact that a lot of substandard programmers use it (...)

    >>If you agree with that, why are you here?

    >
    > Maybe you have misunderstood the name »comp.lang.c++«:
    > It does not mean it's a newsgroups for /C++ advocates/,
    > it is a newsgroup for /discussions about C++/.


    > (Moreover, I have not written that I agree with that.)


    True, but it was posted as a response to a newbie and without comment.
    Someone suggested it might have been a joke: was it?

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, May 23, 2014
    #19
  20. Omar Radwan

    Jorgen Grahn Guest

    On Fri, 2014-05-23, Stefan Ram wrote:
    > d (Drew Lawson) writes:
    >>I am biased by the path I have followed. Personally, I think it
    >>is better to first learn to program with something simple -- C,
    >>Pascal, BASIC -- to get the core concepts. That view is not dominant

    >
    > Pascal, BASIC, and C are all simpler than C++, but C is more
    > close to today's popular languages.

    ....
    > C has the unique feature that very often its calling convention
    > also is the OS' ABI.


    It's not unique -- you can use those OS interfaces just as easily from
    C++. At least on Unix.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, May 23, 2014
    #20
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. PJ6
    Replies:
    7
    Views:
    629
  2. Ed
    Replies:
    24
    Views:
    1,615
    Dimitri Maziuk
    Mar 27, 2006
  3. pabbu
    Replies:
    8
    Views:
    1,050
    Marc Boyer
    Nov 7, 2005
  4. Shravani
    Replies:
    8
    Views:
    1,049
    Bartc
    Mar 16, 2008
  5. Replies:
    28
    Views:
    1,673
  6. Casey Hawthorne
    Replies:
    18
    Views:
    949
    Beej Jorgensen
    Nov 6, 2009
Loading...