1. Use the if statement to write the selection structure of the program, complete the following sub-function evaluation
(Hint: x 1 (1) , x 1 (2) is constant, variable names can be set to X1 and the X2 . )
The Windows version of the program can be as follows (two constant values can also be adjusted):
This is my final running interface:
This is the main code for solving and inserting graphics:
<span style= "FONT-SIZE:24PX;" >void Cmy2dlg::onbutton1 () {//Todo:add your control notification handler code hereupdatedata (); if (m_x<m_x1) m_f=0 ; else if (m_x<=m_x2) m_f= (m_x-m_x1)/(m_x2-m_x1); elsem_f=1; UpdateData (FALSE);} </span>
The following is the association of controls and variables:
Learning experience:
UpdateData ();//used to pass the data displayed by the control to the member variable
UpdateData (FALSE);//used to pass calculated data to the control.
C + + window Junior Practice Project 1 function solving