// bintodec.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(){
string inp;
int dec = 0;
char base;
cout << "Input a number: ";
cin >> inp;
cout << "Input the base your number is in: ";
cin >> base;
for(int i = inp.length()-1, j = 0; i >= 0; i--, ++j) dec += (inp[i]-48) * pow((float)base-48, j);
cout << "Your number in base 10 is: " << dec <<endl;
system("pause");
return 0;
}
hey all can some1 tell me the logic in this code??
like an example of what happens if input a NUMBER and BASE
TY!!