Problem With Pow Function, Help?
Hey...
So I'm having a bit of difficulty with a program I've put together, and it all seems to be surrounding the pow function. I can't even do a simple pow(2,2) without getting an error. And I have included the cmath library.
This is the error I get:
ld:
Unresolved:
pow
Any ideas?
(It's a binary to decimal converter)
Thanks!
Code:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void main ()
{
int count = 0, bin, sum;
char line[32] ;
cin >> noskipws >> line[0] ;
while ( line[count] != '\n' )
{
count ++ ;
cin >> line[count] ;
}
sum = 0;
for ( bin = count - 1; bin >= 0; bin -- )
{
sum = sum + (line[bin] * pow(2,bin));
}
cout << sum;
cout << endl ;
}