quick msg box question

This is a discussion on quick msg box question within the C++ Programming forums, part of the General Programming Boards category; ok, im making a text based rpg but i need msg boxes to show something like "You've earned 12 gold" ...

  1. #1
    Registered User heat511's Avatar
    Join Date
    Dec 2001
    Posts
    169

    quick msg box question

    ok, im making a text based rpg but i need msg boxes to show something like "You've earned 12 gold" on it. Unfortunetly i need the number to be a variable and change if the variable does.
    Any help plz?

  2. #2
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Since you say Msg Box, this is a windows question right?
    And those should be in the windows forum.
    Myself, i have no idea.

  3. #3
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Hmm just like ErionD said this is a Windows specific function you should of asked on the Windows board, but ill answer what I think your askign. If you need to have the value as an int or whatever then store it as one, then when you need to display a message box convert the number to a char ex:
    Code:
    int x = 15;
    char val[33]; // This is the max length that itoa can fill
    
    itoa(x,val,10); // x is the num to convert, val is the buffer to write to and 10 is the base number (10 = Dec, 16 = Hex, 8 = Oct, 2 = Bin)
    
    MessageBox(NULL,"The message",val,MB_OK);
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    591
    Or

    Code:
        CString csText;
        Int iPoints = 5; 
    
        csText.Format("You got %d points", iPoints);
    
        MessageBox("csText");

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 01:59 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. Quick question about replacing laptop harddrive
    By PJYelton in forum Tech Board
    Replies: 4
    Last Post: 01-20-2005, 07:02 PM
  4. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 07:00 PM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21