// FloatAverage - average three numbers using floating point // data type #include #include int main(int nArg, char* pszArgs[]) { float fValue1; float fValue2; float fValue3; cout << "Floating point version:\n"; cout << "Input three numbers (follow each with newline)\n"; cout << "#1:"; cin >> fValue1; cout << "#2:"; cin >> fValue2; cout << "#3:"; cin >> fValue3; // there shouldn't be any difference between... cout << "The add before divide average is:"; cout << (fValue1 + fValue2 + fValue3)/3; cout << "\n"; // ...the two algorithms cout << "The divide before add average is:"; cout << fValue1/3 + fValue2/3 + fValue3/3; cout << "\n"; cout << "\n\n"; return 0; }