Thread: Display a number in a MessageBox

  1. #1
    Registered User
    Join Date
    Dec 2007

    Display a number in a MessageBox

    I am trying to display myValue in the MessageBox. I use C++ 2008.
    How is this possible. It seems that MessageBox in this case only can display a string, "".

    int myValue = 0;
    double myVal2 = 3.14;
    myValue = myVal2;


  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    I would guess stringstream.
    Untested, because I'm lazy:
    std::string myValue;
    std::stringstream myValueSS;
    myValueSS << myVal2;
    myValue = myValueSS.str();

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HELP!!!!emergency Problem~expert please help
    By unknowppl in forum C++ Programming
    Replies: 9
    Last Post: 08-21-2008, 06:41 PM
  2. Random number + guessing game trouble
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-08-2007, 03:33 AM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 05:00 PM