divide.cpp 556 B

1234567891011121314151617
  1. // divide.cpp -- integer and floating-point division
  2. #include <iostream>
  3. int main()
  4. {
  5. using namespace std;
  6. cout.setf(ios_base::fixed, ios_base::floatfield);
  7. cout << "Integer division: 9/5 = " << 9 / 5 << endl;
  8. cout << "Floating-point division: 9.0/5.0 = ";
  9. cout << 9.0 / 5.0 << endl;
  10. cout << "Mixed division: 9.0/5 = " << 9.0 / 5 << endl;
  11. cout << "double constants: 1e7/9.0 = ";
  12. cout << 1.e7 / 9.0 << endl;
  13. cout << "float constants: 1e7f/9.0f = ";
  14. cout << 1.e7f / 9.0f << endl;
  15. // cin.get();
  16. return 0;
  17. }