fork download
  1. // we are going to make a program that will use a #define for replacing a number
  2.  
  3. #include <iostream>
  4. #include <cmath>
  5.  
  6. #define FIVE 5
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.  
  12. cout << "The normal square root of 5 is: " << sqrt(FIVE) << endl;
  13. cout << "The int square root of 5 is: " << (int)sqrt(FIVE) << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
The normal square root of 5 is: 2.23607
The int square root of 5 is: 2