fork(1) download
  1. #include <iostream>
  2. #include <math.h>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. //Declare variables and constants.
  8. float x, log_8_x;
  9.  
  10. int main()
  11. {
  12.  
  13. //Prompt user to input number.
  14. cout << "This program will calculate the log base 8 of a number. Input \
  15. number to calculate" << endl;
  16. cin >> x;
  17.  
  18. //Calculate log_8_x.
  19. log_8_x = log(x) / log(8);
  20.  
  21. //Print log_8_x.
  22. cout << "The log base 8 of " << x << " is " << log_8_x << endl;
  23.  
  24. //End main.
  25. return (0);
  26.  
  27. }
Success #stdin #stdout 0s 3100KB
stdin
Standard input is empty
stdout
This program will calculate the log base 8 of a number. Input number to calculate
The log base 8 of 0 is -inf