CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2008
    Posts
    1

    Red face Can i make string addition operation in c++?

    Can i make string addition operation in c++?

    i want to make string addition operation like;

    hydrogen + 2oxygen = water.

    can i make this ?

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Can i make string addition operation in c++?

    Yes but you have to write the code for that parser yourself, the language itself has no support for handling chemical formulas (as you probably know).

  3. #3
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Can i make string addition operation in c++?

    I am not into chemistry, but I know Hydrogen and Oxygen cannot always be Water - it may be in gas state also!
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Can i make string addition operation in c++?

    Plus it'd be 2hydrogen + oxygen = water, not the other way around....

    Remember, dihydrogen monoxide is deadly in large quantities.

  5. #5
    Join Date
    Apr 2000
    Location
    Frederick, Maryland
    Posts
    507

    Re: Can i make string addition operation in c++?

    In addition it would be

    wataer = (2 * hyderogen) + Oxygen


  6. #6
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Can i make string addition operation in c++?

    I did not know CG has a "Chemistry Forum" too!
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Can i make string addition operation in c++?

    Just to add:

    (hydrogen + oxygen) * 2 = hydrogen peroxide. Time to become a blond(e).

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured