Tech Off Thread

16 posts

I finally found a way to learn C++; what do I do after I am done reading this tutorial?

Back to Forum: Tech Off
  • User profile image
    Shining Arcanine

    In 1999, I taught myself HTML. In late 2002, I started learning PHP with a friend's help. For quite some time, I have wanted to learn computer programming. First C#'s PHP like syntax attracted me to it, but I did not have a compiler to use to start learning. One day, I got a copy of Visual Basic .NET Standard 2003 from Microsoft through a promotion that was on MSDN. I did not realize that Visual Basic was actually another language until after I received Visual Basic .NET Standard 2003, so I tried it and I ended up disliking its syntax. Then later, Microsoft came out with its Express product betas, so I finally got to play with C#, but after a while, I realized that .NET was not an attempt to make things more efficient but an attempt to sacrifice efficiency to increase productivity and being the perfectionist that I am, I did not like that. After inquiring about it on here, I learned that I want to learn C++. I was not sure how to start learning it without using Microsoft's .NET framework, even though I wanted to learn traditional C++. Then time passed, and Microsoft had another promotion on MSDN. This time it was for a copy of Visual Studio 2005 Standard Edition so I procured a copy. I first tried compiling some very complex programs like VirtualDub and Firefox to get an idea of how to use it, which did not work out very well. Time passed and today, I randomly typed "learn C++" into Google and I found the following tutorial:

    http://www.cplusplus.com/doc/tutorial/

    The code examples would not work in Visual Studio 2005 Standard Edition, so I did some research and I found on MSDN instructions on how to make it work:

    http://msdn2.microsoft.com/en-us/library/ms235629.aspx

    Upon following them, I was pretty amazed at how Visual Studio 2005 Standard Edition became like Macromedia Dreamweaver, in that there were no files premade for me and I had to make them on my own, so that when it came to using code examples in the tutorial, things became so simple that I actually understood what all of the code did.

    I am right now reading the section on dynamic memory in the tutorial. I have understood everything so far, due to my PHP background and my prior attempts at learning programming so I need to decide where to go from here when I am done; I figured I could ask here in advance. I would like to learn how to write the code to create an application that has a GUI, but I also want to learn programming in manageable steps. With that in mind, what do people recommend that I do after I am done with this tutorial and where do people recommend that I go to get the information to do what they recommend?

  • User profile image
    Lee_Dale

    I would recommend that you read up on the Windows API and how to create windows by calling CreateWindowEx etc.

    Also learn how Windows apps work i.e. the message loop, events etc. This will give you the foundation to move onto creating controls and stuff.

    You could download CodeBlocks IDE which will create the base code for a windows GUI so you can have a look and see how a windows app is created from just calling API functions. 

    Then you can move on to learing a framework like MFC, .Net, wxWidgets etc and see how they wrap these API's.

  • User profile image
    PerfectPhase

    Shining Arcanine wrote:
    Then later, Microsoft came out with its Express product betas, so I finally got to play with C#, but after a while, I realized that .NET was not an attempt to make things more efficient but an attempt to sacrifice efficiency to increase productivity and being the perfectionist that I am, I did not like that.



    Having spent the last couple of months writing C, I think your reasons for avoiding C# are flawed Smiley

    That said, I think it's a dammed good idea to learn one of the low level languages (meaning C or C++) as I feel it helps you better understand why things work the way they do.  And it aslo helps to make you really appreciate .Net Smiley

    I found this book (well actually the series of web pages it's based on way back when) a good start http://www.relisoft.com/book/index.htm.

    Stephen.

  • User profile image
    Ion Todirel

    C++ is a hi-level language

  • User profile image
    steamer25

    Ion Todirel wrote:
    C++ is a hi-level language


    Height is kind of a relative concept isn't it? Certainly C/C++ is a higher level language than assembly but I'd place it lower than C#.

    Yay, everybody wins! [A]

  • User profile image
    zhuo

    The art of programming can be mastered at many diff levels of abstraction.

    So the right question to ask is perhaps: At what level of abstraction are you trying to learn how to program and to what level of expertise do you want to attain?

    IMO it's quite silly to learn C++ as a beginner, just because it can be more efficient doesn't mean you will write something more efficient using it. In fact, the likelihood is that if you were to write anything of significant value using C#, it would be a lot more efficient than you trying to write it using C++. It's like a young squire wielding a sword to heavy for his size.



  • User profile image
    Shining Arcanine

    zhuo wrote:
    The art of programming can be mastered at many diff levels of abstraction.


    So the right question to ask is perhaps: At what level of abstraction are you trying to learn how to program and to what level of expertise do you want to attain?

    IMO it's quite silly to learn C++ as a beginner, just because it can be more efficient doesn't mean you will write something more efficient using it. In fact, the likelihood is that if you were to write anything of significant value using C#, it would be a lot more efficient than you trying to write it using C++. It's like a young squire wielding a sword to heavy for his size.

    Well, I am now entering college as a freshman and I plan on majoring in Biotechnology and minoring in Computer Science. When I am older, I would like to use C++ in protein engineering applications, so I need the highest efficiency that I can get and I would like to start learning now. I am really looking forward to learning how to use and embed assembly language and how to use compiler intrinsics at some point in time.

    Anyway, the squire analogy is not bad. It was not hard learning the stuff that had analogies in my PHP code, but around the time I reached object oriented programming, I hit a wall. The only way that I could use it at this point would be through a heavy usage of code examples, as I lack experience with it and I do not understand its usefulness. If anyone would know of some examples where object oriented programming is easier than function based programming, I would really appreciate it as it could really help me better understand its concept.

    By the way, does anyone know how one would put code into separate files and then include it into the main file? I have tried using "#include <insert file name.file extension>" but it does not work.

  • User profile image
    Sven Groot

    If you are creating your own header files, don't use #include <file.h> but #include "file.h". The double quotes tell it to look in the current directory, while the angle brackets tell it to look in the include path.

    As for using embedded assembly: won't work on x64, unfortunately (of course you can still use assembly to create an object file and link that in, but __asm is out). And compiler intrinsics are naturally not compiler independant.

  • User profile image
    AndyC

    Shining Arcanine wrote:
    By the way, does anyone know how one would put code into separate files and then include it into the main file? I have tried using "#include <insert file name.file extension>" but it does not work.


    You don't. You should only #include header files. The linker should do the job of combining code from several different files.

  • User profile image
    Shining Arcanine

    AndyC wrote:
    
    Shining Arcanine wrote:By the way, does anyone know how one would put code into separate files and then include it into the main file? I have tried using "#include <insert file name.file extension>" but it does not work.


    You don't. You should only #include header files. The linker should do the job of combining code from several different files.


    How do you use the linker? I am creating name.h files. Should I be creating any other kind of files?

  • User profile image
    AndyC

    Shining Arcanine wrote:
    
    How do you use the linker? I am creating name.h files. Should I be creating any other kind of files?


    Since you're using Visual Studio, that should do all the necessary behind the scenes magic of calling the compiler and then linking it all together based on your project file.

    .h files are header files, they should not contain any actual code. The only things that should be in there are class declarations. The corresponding code should be in a .cpp file. 

  • User profile image
    Sven Groot

    AndyC wrote:
    .h files are header files, they should not contain any actual code. The only things that should be in there are class declarations. The corresponding code should be in a .cpp file. 

    Unless of course you're using templates, or want functions to be inlined. Tongue Out

  • User profile image
    Rossj

    AndyC wrote:
    
    Shining Arcanine wrote:
    How do you use the linker? I am creating name.h files. Should I be creating any other kind of files?


    Since you're using Visual Studio, that should do all the necessary behind the scenes magic of calling the compiler and then linking it all together based on your project file.

    .h files are header files, they should not contain any actual code. The only things that should be in there are class declarations. The corresponding code should be in a .cpp file. 


    Sort of like this..

    ClassA.h
        class XYZ { void SomeMethod(); }

    ClassA.cpp
       #include "ClassA.h"
        void XYZ::SomeMethod() { ..code.. }



    ClassB.h
        // Include ClassA's header file if we use ClassA with this class
        #include "ClassA.h"
       class ABC { void MyMethod(); }

     ClassB.cpp
        #include "ClassB."
         void ABC::MyMethod() { ..code.. }
      

  • User profile image
    AndyC

    Sven Groot wrote:
    
    Unless of course you're using templates, or want functions to be inlined.


    Both of which fall into my "Why C++ is broken" category. Tongue Out

  • User profile image
    qwert231

    Shining Arcanine wrote:
    I finally found a way to learn C++; what do I do after I am done


    I only saw that from the Tech Off screen, and thought 'Done learning C++? That can't happen!'

    But then when I viewed the post I saw the rest of the subject.

    Thank you everybody for the tips, this will help many looking to get into languages deeper than VB, like myself.

  • User profile image
    zhuo

    Shining Arcanine wrote:
    
    zhuo wrote: The art of programming can be mastered at many diff levels of abstraction.


    So the right question to ask is perhaps: At what level of abstraction are you trying to learn how to program and to what level of expertise do you want to attain?

    IMO it's quite silly to learn C++ as a beginner, just because it can be more efficient doesn't mean you will write something more efficient using it. In fact, the likelihood is that if you were to write anything of significant value using C#, it would be a lot more efficient than you trying to write it using C++. It's like a young squire wielding a sword to heavy for his size.

    Well, I am now entering college as a freshman and I plan on majoring in Biotechnology and minoring in Computer Science. When I am older, I would like to use C++ in protein engineering applications, so I need the highest efficiency that I can get and I would like to start learning now. I am really looking forward to learning how to use and embed assembly language and how to use compiler intrinsics at some point in time.

    Anyway, the squire analogy is not bad. It was not hard learning the stuff that had analogies in my PHP code, but around the time I reached object oriented programming, I hit a wall. The only way that I could use it at this point would be through a heavy usage of code examples, as I lack experience with it and I do not understand its usefulness. If anyone would know of some examples where object oriented programming is easier than function based programming, I would really appreciate it as it could really help me better understand its concept.

    By the way, does anyone know how one would put code into separate files and then include it into the main file? I have tried using "#include <insert file name.file extension>" but it does not work.


    good luck with your endeavour. in light of what your goal is, i still think it's well worth your time learning how to do OO programming, and the best way to learn it is not C++.

    in my experience, object oriented programming is not an easy thing to master, it requires at least a year or 2 of experience to make use of it effectively. 

    having said that, i think the best way to approach it is probably to build an asp.net application in your spare time. trust me, it will be well worth your time learning how to do OO programming. building an asp.net application will allow you to learn OO concepts quite effectively without you knowing any OO, you will know what I mean by the time you finish your first app. try building something simple like a forum.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.