TAILIEUCHUNG - Microsoft visual C_7

Tham khảo tài liệu 'microsoft visual c_7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | The Calc Application break case ST_PARENTHESES delete m_pLeftTree break When the user inputs new data into a cell the values of the cells referring to that cell its target set need to be evaluated. Evaluate is called on each referring cell. It calculates the value depending on the structure of the tree. If the formula of the cell has a reference we need to look up its value. That s why pCellMatrix is given as a parameter. If the cell referred to does not have a value an exception is thrown. An exception is also thrown in the case of division by zero. If the parameter bRecursive is true the user has cut and pasted a block of cells in which case we have to recursively evaluate the values of the cells referred to by this syntax tree to catch the correct values. In the case of addition subtraction or multiplication we extract the values of the left and right operand by calling Evaluate on one the sub trees. Then we carry out the operation and return the result. double SyntaxTree Evaluate BOOL bRecursive const CellMatrix pCellMatrix const switch m_eTreeId case ST_ADD double dLeftValue m_pLeftTree- Evaluate bRecursive pCellMatrix double dRightValue m_pRightTree- Evaluate bRecursive pCellMatrix return dLeftValue dRightValue break . case ST_DIV double dLeftValue m_pLeftTree- Evaluate bRecursive pCellMatrix double dRightValue m_pRightTree- Evaluate bRecursive pCellMatrix if dRightValue 0 return dLeftValue dRightValue 264 Chapter 8 else CString stMessage TEXT DIVISION_BY_ZERO throw stMessage break In the case of parenthesis we just return the value. However we still need the parentheses case in order to generate the string of the syntax tree. case ST_PARENTHESES return m_pLeftTree- Evaluate bRecursive pCellMatrix If the referred cell has a value it is returned. If not an exception is thrown. case ST_REFERENCE int iRow int iCol Cell pCell pCellMatrix- Get iRow iCol if pCell- HasValue bRecursive return pCell- GetValue else CString .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.