Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Programing help

  1. Sep 4, 2010 #1
    Tell me why am i not able to compile this program, the terminal lists various errors

  2. jcsd
  3. Sep 4, 2010 #2


    User Avatar

    Staff: Mentor

    Two tips:

    1. It's a lot faster for other people here if you paste your code directly into your posting instead of making us wait for a large picture to download. To keep the code formatted properly, enclose it in [ CODE ] and [ /CODE ] tags (remove the spaces that I added between the brackets).

    2. It helps a lot if you tell us what compiler error messages you got, and what line they refer to.
  4. Sep 4, 2010 #3
    I am new to programming , i will do wat u said ...
  5. Sep 4, 2010 #4


    User Avatar

    Staff: Mentor

    Think of it this way: when you go to the doctor, you don't just tell him, "I hurt." You tell him where you hurt and what kind of pain it is. :smile:
  6. Sep 10, 2010 #5
    Worked fine for me.
    What did you type to compile?

    Looks like you are in Ubuntu, so try:
    g++ sinx3.cpp -o runMe
  7. Sep 11, 2010 #6
    I may be off here, but it appears that those first three lines are supposed to be comments but aren't being treated as such. If you notice the words 'buffer' 'is' and 'for' are all syntax highlighted. Also the text between the single quotes in don't and file's is highlighted as if it were a string constant.

    I recommend changing those double semicolons to double slashes like the rest of the comments.
  8. Sep 11, 2010 #7
    Yeah it seems you have written it in the Emacs *scratch* buffer and then saved it to file, remove the first 3 lines. Then try to compile with the command already written here.
  9. Oct 3, 2010 #8
    i dont know if this will help your problem at all but im also new to c++ and i have just gotten in the habit of including: "#include <cstdlib>" ; and "using namespace std". in all of my programs
  10. Oct 4, 2010 #9
    @ Bad
    He's writing in C, not C++
    But aside from that, namespace std - in the future you should consider only import those that actually needed.
    But at the moment it's okay.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Programing help
  1. Programming Help (Replies: 4)

  2. Programming help (Replies: 2)

  3. Help with programming (Replies: 5)