arith.cpp 629 B

12345678910111213141516171819202122
  1. // arith.cpp -- some C++ arithmetic
  2. #include <iostream>
  3. int main()
  4. {
  5. using namespace std;
  6. float hats, heads;
  7. cout.setf(ios_base::fixed, ios_base::floatfield); // fixed-point
  8. cout << "Enter a number: ";
  9. cin >> hats;
  10. cout << "Enter another number: ";
  11. cin >> heads;
  12. cout << "hats = " << hats << "; heads = " << heads << endl;
  13. cout << "hats + heads = " << hats + heads << endl;
  14. cout << "hats - heads = " << hats - heads << endl;
  15. cout << "hats * heads = " << hats * heads << endl;
  16. cout << "hats / heads = " << hats / heads << endl;
  17. // cin.get();
  18. // cin.get();
  19. return 0;
  20. }