Thread: Square root
View Single Post
  #1 (permalink)  
Old December 12th, 2004, 10:52 AM
Ashleek007 Ashleek007 is offline
Authorized User
 
Join Date: Jan 2004
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ashleek007
Default Square root

Hi,

Im currently making a calculator in c++.net 2003.

I've got it to 'square' numbers and produce a result. Heres the code:-

void CAssignmentDlg::OnBnClickedButton21()
{
    m_fSquare=m_fSquare+atof(m_sDisplay);
    m_sDisplay="";
    m_fSquareRes = m_fSquare * m_fSquare;
    char strSquare[20];
    m_fmem=m_fSquareRes;
    gcvt(m_fmem,6,strSquare);
    for (int i = 0;i<20;i++)
    m_sDisplay = m_sDisplay+strSquare[i];

    UpdateData(FALSE);
}

My problem is how to make another button produce the square rrot of a number, it is essentially the inverse of this code but i really dont know how to do it!

Could someone give me a hand?
Thanks
Ash:D

My new web design domain
www.askmultimedia.co.uk
__________________
My new web design domain
www.askmultimedia.co.uk
Reply With Quote