// This program will read a positive number and // then computes and prints the
ID: 3619921 • Letter: #
Question
// This program will read a positive number and// then computes and prints the logarithm of the value to the base 2
//preprocessor directives.
#define frz system("pause")
#include
#include
#include
using namespace std;
int main ()
{
// Declare variable
double number,value;
//promt user for the munber to be computed
cout <<" Please enter a positive number " << endl;
cin>> number
// compute the log of the given number to the base 2
value = log10(number)/log10(2);
//Print user final answer
cout << " The log of: "<< number << "to the base 2 is: " << value << endl;
frz;
return 0;
}
Explanation / Answer
There was a semicolon mistake... // This program will read a positive number and // then computes and prints the logarithm of the value to the base 2//preprocessor directives. #define frz system("pause") #include <iostream> #include <math.h> #include <cstdlib> using namespace std;
int main () { // Declare variable double number,value;
//promt user for the munber to be computed cout <<" Please enter a positive number " << endl; cin>> number; // compute the log of the given number to the base 2 value = log10(number)/log10(2);
//Print user final answer cout << " The log of : "<< number << " to the base 2 is: " << value << endl;
frz; return 0; } // This program will read a positive number and // then computes and prints the logarithm of the value to the base 2
//preprocessor directives. #define frz system("pause") #include <iostream> #include <math.h> #include <cstdlib> using namespace std;
int main () { // Declare variable double number,value;
//promt user for the munber to be computed cout <<" Please enter a positive number " << endl; cin>> number; // compute the log of the given number to the base 2 value = log10(number)/log10(2);
//Print user final answer cout << " The log of : "<< number << " to the base 2 is: " << value << endl;
frz; return 0; }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.