Trying to learn...C++ in VS .net

This is a discussion on Trying to learn...C++ in VS .net within the C++ Programming forums, part of the General Programming Boards category; Hiya, I have very limited programming experience from years back on a particular programs internal programming/scripting language that was kinda ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    6

    Trying to learn...C++ in VS .net

    Hiya,

    I have very limited programming experience from years back on a particular programs internal programming/scripting language that was kinda a basic/c++ mix (so they said.)

    I'm looking to get into C++ so I picked up a copy of Visual C++ .net a little while back.

    I found some nice tutorials on the net, such as the ones on this site, though I'm confused as to how to get up and running with them. I type in the code - reading what the code is supposed to do, but then it errored out in Visual Studio. Upon exploring it a bit, it seemed that virtually ALL tutorials reference "iostream.h" I did a search and found the file on my HD and added it to my resources of the project... should I have done that? I would have imagined th at simply including the iostream.h in the start of my code would have been enough for VS to search its main paths for the file... I believe it compiled finally, though it still presented errors that I have yet to examine closely... aside from that though...

    I guess what I'm asking is, is it just me or is this an extremely confusing language to learn considering that one can't even rely on a few lines of the simplest code to work because it may be different from one compiler to another? From a small blurb that I read in the VS.net help, it sounded like it said that they were doing away with the iostream.h all together. If so, then what do I use instead when the tutorials reference? Would "cout" still work or would I need another word for that too? ;/

    Perhaps for an experienced C++ programmer, they can easily identify what is different from one compiler to the next, but to a beginner, it's extremely difficult to try and follow step-by-step instructions and then to find out they don't work for their particular programming environment/compiler.

    Any advice on what to study in order to learn C++ .net? I can't really afford another book right now. I just want to get started with some basic tutorials, but again - I'm finding that they don't seem to be working right out of the box. So any assistance/direction would be greatly appreciated.

    Thanks!
    drez

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    18
    Hi
    I think that you should use the MSDN Library especially the Dr GUI articles.They would suffice i guess.The MSDN collection contains enough information about VC++.net i guess.

    Regards
    Venkat

  3. #3
    Registered User codegirl's Avatar
    Join Date
    Jun 2003
    Posts
    76
    I haven't used VS for C++ before, but if I had to guess they're trying to get away from the old C-style .h header files. There's quite a few threads on header files floating around here, but basically you should probably try to use the header files that begin with "c" (like cstring) or at least don't end with .h (like iostream). For a list of some C++ library classes and the functions they contain, go to http://www.dinkumware.com/refxcpp.html. I'm sure there's other sites too, but this is the one I usually go to. And good luck! C++ takes a little time to learn, I'll admit, but it will be worth it!

    (If there's any header file experts out there feel free to add on or correct what I said! )
    My programs don't have bugs, they just develop random features.

  4. #4
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571

    Re: Trying to learn...C++ in VS .net

    Originally posted by drez
    Hiya,

    I have very limited programming experience from years back on a particular programs internal programming/scripting language that was kinda a basic/c++ mix (so they said.)

    I'm looking to get into C++ so I picked up a copy of Visual C++ .net a little while back.
    .NET 2002 or .NET 2003? The new one is better.

    Upon exploring it a bit, it seemed that virtually ALL tutorials reference "iostream.h"
    Because those tutorials aren't up-to-date. "iostream.h" was removed from the C++ language (and replaced with "iostream") in 1998.

    I guess what I'm asking is, is it just me or is this an extremely confusing language to learn considering that one can't even rely on a few lines of the simplest code to work because it may be different from one compiler to another?
    The problem is really that the C++ language itself changed and grew. They made some incredible improvements, things that had been in the works for many years, and the C++ language was much better for it. It also means, though, that pre-1998 C++ code isn't standard anymore.

    Here is an example of a pre-C++98 code:

    Code:
    #include <iostream.h>
    
    int main(){
      cout << "Hello World!" << endl;
      return 0;
    }
    and the equivalent in modern C++:

    Code:
    #include <iostream>
    using namespace std;
    
    int main(){
      cout << "Hello World!" << endl;
    }

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Cat : shouldnt there be return 0; on both your examples ?

  6. #6
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    Not needed after C ++98. The standard states that there is an implied "return 0;" at the end of main, and the standard states that compilers should not give errors or warnings when there is no explicit return statement in main().

    Main() is the only function that gets this implied return; any other int-returning function needs an explicit return.

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Ok, thanks for that

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    C++ is a complex language with lots of header-files, functions, features, and concepts. And, it's not always easy to do simple stuff. (I mean, in BASIC, "Hello World" is one line!)

    COMPILERS:
    I've used a handfull of compilers (mostly obscure) over the last few years, and getting them installed and configured is always difficult and frustrating. It might take 5 minutes, or a day to get an existing program to compile.

    Most compilers "try" to be ISO/ANSI C++ compliant. That means that they will have all of the standard headers / functions, and these functions will work (mostly) correctly.

    Now, in addition to the standard stuff, most compilers will also have non-standard functions. For example, all Windows compatible compilers have all of the Windows-specific API functions. In fact, any graphics or sound functions that your compiler has are non-standard. There are no graphics in standard C++.

    There are lots of example programs "out there" that are compiler-specific, and the non-standard parts are not always documented.

    IT WILL GET BETTER -
    Once you get your compiler set-up and you understand it's quirks, and once you get familiar with how to include the headers, things will get easier... for awhile...

  9. #9
    Registered User
    Join Date
    Jul 2003
    Posts
    6
    Thank you everyone, much appreciated. Couldn't ask for a much better answers. So the confusion seems relatively normal I'll just have to keep reading a bit, I think the .net came with a couple beginner tutorials, I'll have to revisit them. I'd imagine they're written to work...

    Cat, I got 2002 ;/ That significant of improvments over one year eh? I wonder what kind of upgrade choices I have... or does one have to go buy it all over again...

  10. #10
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    If you have anything better than the educational edition (if you have Pro or better), then MS has a deal to upgrade for $30, but that ends in Aug. so act soon.

    It's not vital to upgrade, but compliance increased dramatically in some areas with 2003. Realistically, if it costs more than $40 to upgrade, though, it's probably not worth it, especially for a beginner who won't use the more advanced features anyway.

  11. #11
    Registered User
    Join Date
    Jul 2003
    Posts
    6
    I have the full commercial version... Ya, $30 isn't a bad deal but I think you're right... I may be better off just learning with what I have. If I get the hang of things, cost won't be as much of an issue. I remember really enjoying programming... just another artform as far as I'm concerned. (graphic artwork is my main thang...)

  12. #12
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    If you have the full version, I seriously encourage you to pay the $30. It's more compliant, and these upgrades are only available from the most recent versions -- so if you wanted to get the next version after .NET 2003, you'd pay vastly more. These products retail at $1040 (for the Professional versions), it's well worth it to pay $30 right away and save a thousand later.

  13. #13
    Registered User
    Join Date
    Jul 2003
    Posts
    6
    I spent $70 or so on this actually - it's just C++, not the entire suite of .Net products. Still think I should go for it?

  14. #14
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    Ahh, you have VC++ standard, not VS Professional. $30 upgrade probably isn't even available; the normal version is only $90 for VC++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 05-23-2005, 11:39 AM
  2. Some .NET Distribution Stats
    By nickname_changed in forum C# Programming
    Replies: 2
    Last Post: 05-14-2005, 03:41 AM
  3. making a dll in .net 2.0 and than using it in .net 1.1
    By Rune Hunter in forum C# Programming
    Replies: 2
    Last Post: 04-19-2005, 01:59 PM
  4. Why?
    By gprime in forum C++ Programming
    Replies: 5
    Last Post: 06-13-2004, 04:44 PM
  5. C++ 6 or .NET ??
    By cpp_p in forum C++ Programming
    Replies: 13
    Last Post: 08-01-2002, 09:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21