Thread: Displaying numerical values in a window

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    27

    Displaying numerical values in a window

    Hello again all,
    I have some values stored in a Class Object that I would like to print to the screen. Unfortunately I only seem to be able to find ways of printing strings to the screen. Is there any way of getting values to print? I should point out that i'm using MFC, i realise in c++ its easy to just write cout << value1. Help, as always, is greatly appreciated.

    Incidently below is the code for my object. The values I would like to print out are:

    int m_Cost;
    int m_Penalty;
    int m_Length;
    int m_LineCrosses;
    These will be printed out in the OnDraw function. e.g.
    FunctionToPrintValues(x,y,CLine1.m_cost)

    Code:
    class CLine  
    {
    public:
    		int m_Cost;
    		int m_Penalty;
    		int m_Length;
    		int m_LineCrosses;
    		int m_XYCoOrds[10][2];
    		int m_DrawCoOrds[10][2];
    
    	//function definitions
    	void RandomCoOrd(void);// set the genes
        void DrawLine(CDC* pDC) const;//draw the line
    	int SectionLength(int m_XYCoOrds[][2]);//returns length of section
    	int ncrosses(int m_XYCoOrds[][2]);//gets the number of lines crossed
    
    	CLine();
    	virtual ~CLine();
    
    };

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Printing using MFC.

    Windows specific posts should go in the Windows development board.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 03:22 PM
  2. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  3. Displaying my glut output in my own class window.
    By Queatrix in forum Windows Programming
    Replies: 0
    Last Post: 10-19-2005, 10:09 AM
  4. Problem with creating new window, from another window
    By Garfield in forum Windows Programming
    Replies: 6
    Last Post: 01-11-2004, 02:10 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM