complete noobie, confused on how to tackle c++

This is a discussion on complete noobie, confused on how to tackle c++ within the C++ Programming forums, part of the General Programming Boards category; im using the visualc++.net compiler, and i recently got sam's teach yourself c++ in 21 days. the book says stuff ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    3

    complete noobie, confused on how to tackle c++

    im using the visualc++.net compiler, and i recently got sam's teach yourself c++ in 21 days. the book says stuff like to #include iostream.h for the header, but it doesnt seem to work on .net, and neither does cout and cin and im sure many other commands. im confused on what to do. should i switch to another compiler? or could somebody tell me how to get cout to work and what kind of application to do (ie console app) for starting out. please help its been a very frustating start

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    First you need to understand what .NET is.

    It's basically a platform that allows all sorts of languages like C++, C, Visual Basic, and a new specially made language C#, to use the same sets of functions (so instead of cout for C++, and print for VB, they now all use Consol.Writeline()). These programs will run on any computer with the .NET Framework installed. Right now it's just windows, but several projects are looking to expand this capability to Linux, Solaris, etc...

    That's .NET. Now you can program for the .NET platform in what is Visual C++ .NET, which uses grammar and structure that is VERY similar to the original C++, but as I mentioned earlier, all of the functions are going to be different. Once you understand a bit more you will find msdn.microsoft.com a great resource, as it has a complete listing of all of these functions and explanations of their usage.

    You have a choice here. You can learn regular C++, which means you have the right book but the wrong compiler. Or you can learn .NET, which means you've got the right compiler, but the wrong book. This site has some great recommendations for both.

    If you want to pick one of the languages, I'd be happy to explain in a little more detail and some recommendations of my own.

    I hope this helps - feel free to IM me on SeanMackrory@aol.com, or sean_mackrory@hotmail.com, or just PM me.

  3. #3
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    Code:
    #include <iostream>
    using namespace std;
    use that instead.

  4. #4
    ---
    Join Date
    May 2004
    Posts
    1,379
    >so instead of cout for C++, and print for VB, they now all use Consol.Writeline()
    so .NET is not ANSI C++?

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,592
    > so .NET is not ANSI C++?
    Yes it is
    It also has access to a large number of non ANSI API calls, of which that is just one example.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    14
    I would recommend using Dev-C++ ( www.bloodshed.net ) because its easy. For C++ you don't need .Net. Dev-C++ regards C++ ISO (1998) standard.

    Here is an easy example.

    #include <iostream>
    #include <conio.h>
    using namespace std;

    int main()
    {
    const double PI = 3.141592;
    double r, v; // radius, volume

    cout << "calculation of bowl volume: " << endl << endl;
    cout << "please enter radius." << endl;
    cout << "radius = ";
    cin >> r;

    v = 4.0 / 3.0 * PI * r * r * r ; //equation

    cout << "volume = " << v;
    cout << endl;

    getch();
    }

  7. #7
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74
    You can still use the Visual Studio.Net to write standard C++. You do not have to switch compilers. When you create a project just select a win32 console app. not a console.Net app. that way you can use the standard syntax and follow along with the book you are using.

    My advice to you would be when creating a standard win32 console app to follow along with the book is, when you create a project by selecting win32 console app, then when the win32 application wizzard pops up , select application settings and select empty project. then click finish. Then right click the source folder, click add new item then select cpp.This way you can add your own Main.cpp and not have the wizzard generate one for you that will include stdafx.h.

    P.S. If your using a book that say's to #include <iostream.h> and not <iostream> . then you need an updated book.

    Hope this helps
    Last edited by big146; 07-04-2004 at 07:46 AM.
    big146

  8. #8
    Registered User
    Join Date
    Jul 2004
    Posts
    14
    To my mind noobies with a C++ starter book do not need projects. They often use single xxx.cpp. With Dev-C++ this is just a snap. No project, just a new source file and compiling/linking/running.
    ... and Dev-C++ is freeware.
    Compare both IDE's with the example above and make your own decision.
    Last edited by Erhard Henkes; 07-04-2004 at 07:51 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Confused with array size
    By desmond5 in forum C Programming
    Replies: 4
    Last Post: 12-04-2007, 04:14 PM
  2. confused.. in selecting my line of deapth
    By jawwadalam in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-04-2003, 01:21 PM
  3. Doom Lord engine complete!
    By Leeman_s in forum Game Programming
    Replies: 8
    Last Post: 05-12-2002, 12:44 AM
  4. doom lord engine complete!
    By Leeman_s in forum C++ Programming
    Replies: 4
    Last Post: 04-25-2002, 08:41 PM

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