fork download
  1. //This programs is for estimating Ocean levels
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6. // Rising rate per year in millimeters
  7. double riseRate = 1.5;
  8.  
  9. // Calculate future rises
  10. double riseIn5Years = riseRate * 5;
  11. double riseIn7Years = riseRate * 7;
  12. double riseIn10Years = riseRate * 10;
  13.  
  14. // Display results
  15. cout << "In 5 years, the ocean level will be " << riseIn5Years << " millimeters higher." << endl;
  16. cout << "In 7 years, the ocean level will be " << riseIn7Years << " millimeters higher." << endl;
  17. cout << "In 10 years, the ocean level will be " << riseIn10Years << " millimeters higher." << endl;
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5328KB
stdin
Standard input is empty
stdout
In 5 years, the ocean level will be 7.5 millimeters higher.
In 7 years, the ocean level will be 10.5 millimeters higher.
In 10 years, the ocean level will be 15 millimeters higher.