I'm very new to coding (like one day ago), so you can pretty much assume I know nothing. I'm finding it very hard to debug my extremely simple programs and most of the help I've seen online is either over my head or too specific to the program.
This is the code I'm working on now.
/*
* LogBase8.cpp
*
* Created on: Feb 13, 2015
* Author: Holly
*/
//This program calculates the log base 8 of a number.
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
//Declare variables and constants.
float x, log_8_x;
int main()
{
//Prompt user to input number.
cout << "This program will calculate the log base 8 of a number. Input number to calculate" << endl;
cin >> x;
//Calculate log_8_x.
log_8_x = log(x) / log(8);
//Print log_8_x.
cout << "The log base 8 of " << x << " is " << log_8_x << endl;
//End main.
return (0);
}
I have an error in the log_8_x = log(x) / log(8);
line that says
no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and 'double')
I'm using Eclipse, if that's relevant.