Home > Back-end >  I think in the MFC output four calculate calculate number, as the number of output four now help me
I think in the MFC output four calculate calculate number, as the number of output four now help me

Time:11-20

Void Ccomputerprice1Dlg: : OnBnClickedButton1 ()
{
Cstrings str1 str2, str3, str4;
Double a, [4].
GetDlgItem (IDC_EDIT1) - & gt; GetWindowTextW (str1);
GetDlgItem (IDC_EDIT2) - & gt; GetWindowTextW (str2);
GetDlgItem (IDC_EDIT3) - & gt; GetWindowTextW (str3);
GetDlgItem (IDC_EDIT4) - & gt; GetWindowTextW (str4);

A [0]=_ttof ((TCHAR *) (LPTSTR) (LPCTSTR) str1);
A [1]=_ttof ((TCHAR *) (LPTSTR) (LPCTSTR) str2);
A [2]=_ttof ((TCHAR *) (LPTSTR) (LPCTSTR) str3);
A [3]=_ttof ((TCHAR *) (LPTSTR) (LPCTSTR) str4);

//TODO: add the control notification handler code
int i;
Double jizhunjia=0, sum=0;


Double dCout [4].
DCout [0]=0.00;
DCout [1]=0.00;
DCout [2]=0.00;
DCout [3]=0.00;



If (len & gt;=4)//calculate the benchmark
{
If (a [3] & gt;=a [0] * 0.9)
{
for (i=0; i <4. I++)
{
Sum=a [I] + sum;
}
Jizhunjia=sum/4;
}

Else if (a [3] {
for (i=0; i <3; I++)
{
Sum=a [I] + sum;
}
Jizhunjia=sum/3;
}
}


for (i=0; i {
[I] K=abs (a [I] - jizhunjia)/jizhunjia) * 100;
}


for (i=0; i {
If (a [I] <=jizhunjia)
{
If (K [I]
=5){
DCout [0]=80;
DCout [1]=80;
DCout [2]=80;
DCout [3]=80;
}

Else if ((5 & lt; K [I]) & amp; & [I] (K & lt;=10))
{
DCout [0] [I] * 0.5=80 - K;
DCout [1] [I] * 0.5=80 - K;
DCout [2] [I] * 0.5=80 - K;
DCout [3] [I] * 0.5=80 - K;

}
Else if ((10 & lt; K [I]) & amp; & [I] (K & lt;=20))
{
DCout [0] [I] * 0.75=80 - K;
DCout [1] [I] * 0.75=80 - K;
DCout [2] [I] * 0.75=80 - K;
DCout [3] [I] * 0.75=80 - K;
}
Else if (K [I] & gt; 20)
{
DCout [0] [I]=80 - K * 1;
DCout [1] [I]=80 - K * 1;
DCout [2] [I]=80 - K * 1;
DCout [3] [I]=80 - K * 1;
}
}



If (a [I] & gt; Jizhunjia)
{
If (K [I]
=5){
DCout [0]=80;
DCout [1]=80;
DCout [2]=80;
DCout [3]=80;
}
Else if ((5 & lt; K [I]) & amp; & [I] (K & lt;=10))
{
DCout [0] [I] * 0.75=80 - K;
DCout [1] [I] * 0.75=80 - K;
DCout [2] [I] * 0.75=80 - K;
DCout [3] [I] * 0.75=80 - K;

}
Else if ((10 & lt; K [I]) & amp; & [I] (K & lt;=20))
{
DCout [0] [I]=80 - K * 1;
DCout [1] [I]=80 - K * 1;
DCout [2] [I]=80 - K * 1;
DCout [3] [I]=80 - K * 1;
}
Else if (K [I] & gt; 20)
{
DCout [0] [I] * 1.25=80 - K;
DCout [1] [I] * 1.25=80 - K;
DCout [2] [I] * 1.25=80 - K;
DCout [3] [I] * 1.25=80 - K;

}

}

}
/////////////////////////////////////////////////////////////////////////////////

Cstrings cs;
//dCout=12345.12345;
Cs. The Format (_T (" % 2 f "), dCout [0]).
GetDlgItem (IDC_EDIT8) - & gt; SetWindowText (cs);
Cs. The Format (_T (" % 2 f "), dCout [1]).
GetDlgItem (IDC_EDIT9) - & gt; SetWindowText (cs);
Cs. The Format (_T (" % 2 f "), dCout [2]).
GetDlgItem (IDC_EDIT10) - & gt; SetWindowText (cs);
Cs. The Format (_T (" % 2 f "), dCout [3]).
GetDlgItem (IDC_EDIT11) - & gt; SetWindowText (cs);





}

CodePudding user response:

Each time to write
DCout [0]=
DCout [1]=
DCout [2]=
DCout [3]=
Is equal to the same value, dCount [4] in all values are the same, so IDC_EDIT8 - IDC_EDIT11 display Numbers are the same,
  • Related