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

Check out my chemistry program

  1. Dec 1, 2003 #1
    I just uploaded a project to sourceforge. I got the idea from a windows program that I used in the lab this semester. The program is simple, but it still does more than the windows program I had to use (yay), and you don't have to use a mouse. The project is at http://sourceforge.net/projects/mmconv/

    I still need to put an install target in the makefile, but I haven't figured out how to get the system's man page directory. I hear it should be $MANPATH, but $MANPATH isn't defined on my RH 8.0 system so I'm still looking into it.
  2. jcsd
  3. Dec 1, 2003 #2


    User Avatar
    Staff Emeritus

    We're Sorry.
    The SourceForge.net Website is currently down for maintenance.
    We will be back shortly

    O, well. Maybe tommorrow.

    About the man pages, have you tried doing man man
  4. Dec 2, 2003 #3


    User Avatar
    Staff Emeritus

    Just playing around with the program a little here are some bugs I found:

    1. Seg Fault when '?' is entered
    Hint: Simply check if \0 is the next character in the string. If it is, error, else proceed to error check some more

    2. Seg Fault when F1-F4 are pressed
    Hint: Check for unusual ascii characters

    3. Seg Fault when return is pressed with no input.
    Hint: Check to see if there is anything in the string before processing it.

    4. Memory Leaks Galore
    Hint: Walkthrough program with debugger and make sure you free everything you allocate. Use an app like memprof to help you deduce which function the memory leak is coming from.

    5. Integer/Float overflow
    Hint: If you don't want to bother with large numbers, atleast warn the user and don't print out wrong answers.

    6. Any number of periods accepted anywhere in the formula
    Hint: Check for multiple periods within numbers. Also check for stray periods

    Look what I did:

    compound > H.H......
    mass (g) > ...
    H : nan g
    H : nan g

    7. Characters Accpeted for Mass
    Hint: Check your string to make sure the characters are between '0' and '9'

    8. Multiple Instances of Element Printed
    Hint: Flag the elements you've already printed out, so you don't repeat them.
  5. Dec 4, 2003 #4


    User Avatar
    Staff Emeritus

    9) Your allowed to type a question mark followed by the element. It puts everyone on one line if you do.

    compound > ?HI
    mass H (g) > 2
    mass I (g) > 3
    H 1.000000 I 0.011914
    Total mass (g): 5.000000
  6. Dec 5, 2003 #5
    Ok, I fixed 1-4. 5 I'll fix later. 6&7 I'm not worried about right now, but I didn't know that was there so thanks for pointing them out and I'll fix them when i have some more time. 8 is a feature, and I prettied up the output of ? so 9 is "fixed". Thanks for all of the input, dduardo.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Check out my chemistry program
  1. My C++ program's flaw (Replies: 19)