Hello fellow programmers :))
just started c++ a month ago and in need of major helpzz!!

so basically I need code that:
INPUT NUMBER-->BASE OF NUMBER-->PRINTS DECIMAL REPRESENTATION OF IT

Im trying this code..when i put any number and base I just get 0

pleaxxxx help!!!

ty all!!

#include <iostream>
#include <cmath>

using namespace std;


int main()
{

    string inp;
    int j;
    int dec=0;  //store
    char base;
    cout << "input number: ";
    cin >> inp;
    cout << "input base: ";
    cin >> base;
    for (int i = inp.length ()-1; j == 0; ++j) dec += (inp[i]-48) * pow ((float) base-48,j);
    cout << "your number in base 10 is: " << dec << endl;

return 0;
}

On line 18, you need to rethink about how you read through a string and calculate a base 10 number from base 2. Look at this thread http://www.daniweb.com/software-development/cpp/threads/384907 and read the bottom part which is my post. You should see how it is calculated. Then use that in your loop to get the correct value.