New to C++

This is a discussion on New to C++ within the C++ Programming forums, part of the General Programming Boards category; Hello. I am very new to the C++ language. I know absolutly nothing about C++ but I want to learn. ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    1

    New to C++

    Hello. I am very new to the C++ language. I know absolutly nothing about C++ but I want to learn. I have a few questions though:

    Is this the right forum that a very new person should be on to learn?
    Is there a better forum or site that would suit my needs better than this one?
    I know that I need a compiler for programming but I have no idea where to get one or what one would be good for a beginner. Can you help me find one?

    I apoligize for being very new and asking very newbie questions if this forum is meant for advanced learners but I really have no idea what I am doing. LOL

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    i think this is a very good C/C++ forum website. (or i wouldnt visit it!)

    for a compiler and IDE, there are many, free and commercial. a nice small one is Dev-C++. visit here for the download page. scroll down to 'downloads' and the one you want is the first one in the list: Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2. when it asks you during the install/setup for code completion (or something similar) choose to turn it on.. itll be helpful in the future eventually.
    dev-c++ is for windows, if your on linux then 'g++' is probably already installed and is the best one ive used. (although ive only used like 3 different compilers).

    here are a few great links (from this domain) with tons of information, to start learning and following along:
    Getting Started with C++
    Programming Tutorials
    FAQ

    when you run into a problem, it is usually quickest to search forums for the answer. if you cant find it, make a thread in the appropriate forum. be sure to give a descriptive (but short) thread title, include any relevant code your working on, and include all complete error/warning messages you receive.

    good luck!

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    10
    I too am new and trying to learn C++ for fun, however the whole compiler thing has me baffled. I tried to do that quick tutorial on "how do I us a compiler", followed it word for word, but nothing happened. I have also tried the watcom compiler with IDE and had the same issues. Any ideas on how I can figure out how to use a compiler so I can learn C++?

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by JimRoach View Post
    I too am new and trying to learn C++ for fun, however the whole compiler thing has me baffled. I tried to do that quick tutorial on "how do I us a compiler", followed it word for word, but nothing happened. I have also tried the watcom compiler with IDE and had the same issues. Any ideas on how I can figure out how to use a compiler so I can learn C++?
    First thing to learn is how to communicate with other humans properly in context of programming. You'll find that the reason you have trouble with programming later on is sometimes because you fail to think things through properly. This is just what many newbie programmers go through because they have trouble thinking in "verbose terms", if I'm allowed to make that term up.

    When you tell us "nothing happened" when you tried to setup a compiler, that means nothing to us. If you are having car trouble, and you tell the mechanic that it "doesn't work", or that "nothing happens" when you try to start it, he has to look at it himself or ask you 20 questions until you tell him more about the problem for him to give a proper diagnosis. Try telling a doctor that your arm doesn't work. If it turns out that you mean you experience pain while moving it, you should say exactly that.

    Try to give more details about your problems. Explain to us what you've done already, and we should be able to better help you.

    Lastly, enjoy C++, and programming in general, and welcome to cboard.

  5. #5
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    in other words read this!!!

    It'd be great if there was some way of forcing people to read that doc before starting programming. Perhaps with eyelids held open and Beethoven played loudly....
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  6. #6
    Registered User
    Join Date
    May 2007
    Posts
    10
    MacGyver: I opened a new project, created a filename then typed in the code as shown, as follows:

    #include <iostream.h>
    int main()
    {
    cout<<"the Compiler Works";
    cin.get();
    return 0;

    I get message that project compiled successfully, but that's it. I guess I was expecting it to do something, you know, how they always do that Hello World example. I guess I was expecting some text windo to open with that printed out.

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    88
    Whatever source you got that code snippet from, stop reading it, it teaches ancient C++.

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    903
    I ditto that. Non-standard C++ is evil.

    Also, in the same menu item you used for Compiling, click on the Run button. It will run the program.

  9. #9
    Registered User
    Join Date
    May 2007
    Posts
    10
    Actually, I got that code snippet from this web site. But I also tried the first one under the tutorials. I forgot to add that I hit execute and run, which is what confused me, because I was expecting something to happen.

  10. #10
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Code:
    #include <iostream>
    
    int main()
    {
    	std::cout << "Hello, world" << std::endl;
    	return 0;
    }
    Something like this should work I think, from the command line.

  11. #11
    Registered User
    Join Date
    May 2007
    Posts
    88
    > Actually, I got that code snippet from this web site.

    Yes, you'll find that, despite the current standard being ratified in early 1998, pre-ISO C++ is still very pervasive. Even this website had tutorials written in pre-standard C++ until about 2 years ago.

  12. #12
    Registered User
    Join Date
    May 2007
    Posts
    10
    Quote Originally Posted by ChaosEngine View Post
    in other words read this!!!

    It'd be great if there was some way of forcing people to read that doc before starting programming. Perhaps with eyelids held open and Beethoven played loudly....
    Before asking a technical question by e-mail, or in a newsgroup, or on a website chat board, do the following:

    Try to find an answer by searching the archives of the forum you plan to post to.

    Try to find an answer by searching the Web.

    Try to find an answer by reading the manual.

    Try to find an answer by reading a FAQ.

    Try to find an answer by inspection or experimentation.

    Try to find an answer by asking a skilled friend.

    I tried all of the above, and could not find an answer, which is why I looked on a thread of another person expressing questions in the same vein.

  13. #13
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Yes, but your description of your problem was sorely lacking, to put it mildly.

    So, did the code I give you work? If not, what did you try? What did you expect it to do? What actually happened?

  14. #14
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    Maybe everything worked, and the problem is the screen flashes for a moment before disappearing. The "hello world" was momentarily visible, but then nothing.

    Mmm - I've read this somewhere before - the letters 'F' 'A' and 'Q' have something to do with it as I recall
    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.

  15. #15
    Registered User
    Join Date
    May 2007
    Posts
    10
    ok, you are right, I needed to be more specific.

    I may not have done it right, what you recommended was to try it from the command line, so, I opened the command prompt, I am using Windows XP, Media addition @ the C:\ prompt I got a Syntax error after typing the first line: #include <iostream>. So I typed in edit at the prompt, got the test editor....as you can imagine I was pretty much lost from there.

    I also tried the code you gave me on my compiler(I am using Dev-C++4) Under execute, then compile, after compiling clicked on run. Now I get a message at the bottom(under compiler) that the project compiled successfully. and under the compile log, that it both compiled and linked.

    However, that is it. I guess I was epecting some text file or new window to pop up saying "Hello World". I think I am just completely lost and befuddled.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

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