fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main ()
  5. {
  6. double x = 1.7;
  7.  
  8. // Explicit conversion from double to int
  9. int sum = (int)x + 1;
  10.  
  11. cout << "Sum = " << sum;
  12.  
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 4324KB
stdin
Standard input is empty
stdout
Sum = 2