Thread: New to C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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,210
    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
    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.

  6. #6
    0x01
    Join Date
    Sep 2001
    Posts
    88
    Quote Originally Posted by MacGyver View Post
    First thing to learn is how to communicate with other humans properly in context of programming.
    MacGyver, first thing you need to learn is how to communicate with other humans (not birds, bears, snakes or those extra terrestrials) who happen to be completely new to programming.
    Quote Originally Posted by MacGyver View Post
    You'll find that the reason you have trouble with programming later on is sometimes because you fail to think things through properly.
    Because we love to write flawed code on purpose...right?
    Quote Originally Posted by MacGyver View Post
    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.
    You know, it could just be that... um, hes new? I guess it is a little odd when we usually understand all that there is to know at birth.

    Quote Originally Posted by MacGyver View Post
    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.
    Yeah JimRoach, ya stupid son of *itch! What the hell were you thinking? Do you want to get killed? This is the CBoard, you need to be a little bit more careful.

    Wow heh, that MacGyver is just oh so cool

    Quote Originally Posted by MacGyver View Post
    Lastly, enjoy C++, and programming in general, and welcome to cboard.
    Ahem. I just want to let you know... I too would like to welcome you to the cboard (but only because its ok with MacGyver) and enjoy C++, ok Buddy? Enjoy C++, it is MacGyvers creation afterall. ...............But I swear to G*d if you act up or deliberately disobey our precious smart-questions faq we'll #@#@^* #@*&$^ @#$^*&@# @#$&*^#@ your whole family! Oh, and did I say welcome to the cboard yet?
    Quote Originally Posted by MacGyver
    Yes, but your description of your problem was sorely lacking, to put it mildly.
    Whoa, JimRoach. We can all tell you, he did indeed put it mildly. He must be in a good mood or something because he usually doesn't do that.

    Quote Originally Posted by MacGyver
    So, did the code I give you work? If not, what did you try? What did you expect it to do? What actually happened?
    I think he expected it to tear a hole in the universe. He must have been very surprised when it just printed "Hello, World" to his screen.

    Quote Originally Posted by ChaosEngine
    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....
    Yes, I agree. Instead of telling him what he needs to know, lets get him to read some lame faq written by some stoic obese individual so he can stop making our lives so difficult with his improper forum etiquette. However, its threads like this that give us the chance to increase our post counts and increase our cool-points by flaming the thread starter, throwing up a faq, and say things like "We should force people to read our smart-questions faq. Perhaps with eyelids held open and Beethoven played loudly...." Admit it ChaosEngine, you love these threads... c'mon, be honest.

    Incase you are thinking of complaining about this post, think again. It would be against the smart-questions faq under On Not Reacting Like A Loser:
    "Odds are you'll screw up a few times on hacker community forums — in ways detailed in this article, or similar. And you'll be told exactly how you screwed up, possibly with colourful asides. In public.
    When this happens, the worst thing you can do is whine about the experience, claim to have been verbally assaulted, demand apologies, scream, hold your breath, threaten lawsuits, complain to people's employers, leave the toilet seat up, etc. Instead, here's what you do: Get over it. It's normal. In fact, it's healthy and appropriate."

    So if any of you complain, I'll blow the whistle as loud as I can in your face and red card you. (and as the title of that section says, you will be reacting like a loser.. so becareful)
    Quote Originally Posted by swgh
    The FAQ code is rather old to be honest. But it should be correct.
    No more than 1 minute after your previous post. I have a better idea. After every word you type in a reply you can hit Submit Reply and stretch your post/reply through-out a thread simultaneously increasing your post count. This way, if your reply consists of 1000 words; you just increased your post count by 1000!

    JimRoach
    Tutorials (most of them) are not going to be enough for you. You need a book.

    1. Drive to your local book store (B&Nobles, Books-a-gazillion*2, etc)
    2. Find the computer section (you must to be IN the store to do this)
    3. Look for a modern book about C++ (do not get a reference book)
    4. Take the book off the shelf. Look in the book. (Place the weight of the book on your right hand, then use your left hand to peel back the cover to expose the pages)
    5. If the book looks like it will teach you C++ from the ground up, close the book. (take your left hand off the book and place it under the cover of the book and lift up)
    6. Walk over to a register (with the book in hand) and explain to the employee that you would like to purchase the book. (note: that you cannot walk out of the store until you pay for the book)

    Books will go into detail on why you are doing what you are doing, whats happening when you are doing whatever it is your doing and even tell you what NOT to do and things to watch out for. Some will even show you clever solutions to common problems.
    http://cboard.cprogramming.com/showthread.php?t=74078 Read one, practice and when you encounter a problem or you can't grasp an idea; post it. (if you post code, be sure to place [ code ] ... [/ code ] tags around it)
    Last edited by knave; 05-12-2007 at 09:14 AM.

  7. #7
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Quote Originally Posted by knave View Post
    MacGyver, first thing you need to learn is how to communicate with other humans (not birds, bears, snakes or those extra terrestrials) who happen to be completely new to programming.
    I take it you're telling me that I come across as relatively non-friendly, which would be an accurate assessment. I hope no one takes offense at it, since this is the Internet, and text can be taken the wrong way at times.

    Quote Originally Posted by knave View Post
    Because we love to write flawed code on purpose...right?
    Mmm, no. Many times new programmers fail to think things through properly because they intuitively know how to do simple tasks, but they have very little experience with expressing how they are able to achieve the results. For example, many people are well able to tell you if a word is a palindrome, but that does not mean they can write a C/C++ function that will do the same thing. Many times they can't even break down the problem small enough to code it before they get themselves confused. Part of writing a function like this when brand new requires them to think differently than they might be used to.

    Quote Originally Posted by knave View Post
    You know, it could just be that... um, hes new?
    Yes, that's exactly what I said.

    Quote Originally Posted by knave View Post
    I think he expected it to tear a hole in the universe. He must have been very surprised when it just printed "Hello, World" to his screen.
    You want me to assume this guy is brand new, but that he's well familiar with a Hello, world program when he couldn't get one to work earlier? I'd rather not play 20 questions with people that tell me that the code I give them "doesn't work". I'd like to get through the garbage of lousy communications and cut to the heart of the matter. The person asking for help learns how to actually ask a question, as well as the solution to their question.

    Now as I said, I'm not the most friendliest person on the planet, but to my credit I do try to assist people. I find it irritating when people either cannot or choose not to express their thoughts in some complete form that I, or anyone else that could potentially help them, are able to understand.

    I naturally hope JimRoach was not offended by anything I said, since I really didn't mean anything to be offensive. From his reaction, I don't think he took my words the wrong way. In fact, I would imagine he would have more of a problem with your way of telling him how to hold and open a book, but I naturally could be wrong.

  8. #8
    0x01
    Join Date
    Sep 2001
    Posts
    88
    Quote Originally Posted by MacGyver View Post
    I take it you're telling me that I come across as relatively non-friendly, which would be an accurate assessment. I hope no one takes offense at it, since this is the Internet, and text can be taken the wrong way at times.
    You're right, text can be "taken the wrong way." However, in this case it wasn't. It was an "accurate assessment."

    Quote Originally Posted by MacGyver View Post
    Mmm, no. Many times new programmers fail to think things through properly because they intuitively know how to do simple tasks, but they have very little experience with expressing how they are able to achieve the results.
    He doesn't even understand a compiler. This is almost random...

    Is equivalent to:

    Many times new bicyclers fail to balance or use the pedals properly (when at first attempting to ride a bike) because they have become too accustomed to walking and running.

    And??? Does something like that even need to be said/posted? "some" of your posts remind me of cotton candy, when I try to eat it, it dissolves so quickly its like nothing was there.

    Quote Originally Posted by MacGyver View Post
    Yes, that's exactly what I said.
    Yeah... that was the problem. Did you think we needed a reminder? - Thanks?

    Quote Originally Posted by MacGyver
    So, did the code I give you work?
    It was standard C++.
    Quote Originally Posted by MacGyver
    What did you expect it to do?
    Print "Hello, World" maybe?
    Quote Originally Posted by MacGyver
    What actually happened?
    Yeah, it definitely printed "Hello, World"

    Quote Originally Posted by MacGyver View Post
    In fact, I would imagine he would have more of a problem with your way of telling him how to hold and open a book, but I naturally could be wrong.
    Naturally.
    Last edited by knave; 05-12-2007 at 01:41 PM.

  9. #9
    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?

  10. #10
    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.

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

  12. #12
    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.

  13. #13
    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.

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

  15. #15
    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.

Popular pages Recent additions subscribe to a feed