// IntAverage - average three numbers using integer // data type #include #include int main(int nArg, char* pszArgs[]) { int nValue1; int nValue2; int nValue3; cout << "Integer version\n"; cout << "Input three numbers (follow each with newline)\n"; cout << "#1:"; cin >> nValue1; cout << "#2:"; cin >> nValue2; cout << "#3:"; cin >> nValue3; // the following solution suffers from minor roundoff cout << "The add before divide average is:"; cout << (nValue1 + nValue2 + nValue3)/3; cout << "\n"; // this version suffers from serious roundoff cout << "The divide before add average is:"; cout << nValue1/3 + nValue2/3 + nValue3/3; cout << "\n"; cout << "\n\n"; return 0; }