//float fValue = pLin->m_AquireIAndVThread.fAverageI; pLin->m_AquireIAndVThread.fAverageI = (pLin->m_AquireIAndVThread.fAverageI > -0.0004 && pLin->m_AquireIAndVThread.fAverageI < 0.0001) ? 0 : pLin->m_AquireIAndVThread.fAverageI; strDataTemp.Format("%f;", pLin->m_AquireIAndVThread.fAverageI);/ strSaveData += strDataTemp;改写成if else 语句
时间: 2024-03-03 16:48:00 浏览: 61
article4.zip_delphi XML_in_xml
可以将代码改写成如下if-else语句:
```
float fValue = pLin->m_AquireIAndVThread.fAverageI;
if (pLin->m_AquireIAndVThread.fAverageI > -0.0004 && pLin->m_AquireIAndVThread.fAverageI < 0.0001) {
pLin->m_AquireIAndVThread.fAverageI = 0;
} else {
pLin->m_AquireIAndVThread.fAverageI = pLin->m_AquireIAndVThread.fAverageI;
}
strDataTemp.Format("%f;", pLin->m_AquireIAndVThread.fAverageI);
strSaveData += strDataTemp;
```
其中,如果pLin->m_AquireIAndVThread.fAverageI的值大于-0.0004且小于0.0001,则将其赋值为0;否则保持其原有的值不变。最后将该变量的值转换为字符串类型,并添加到strSaveData这个字符串变量中。
阅读全文