#include <iostream>
#include <sstream>
usingnamespace std;
int main()
{
int value = 0;
int b = 0;
cout << "Enter a base 10 number: ";
cin >> value;
cout << "Enter the base you want to convert the number to: ";
cin >> b;
string convert(value, b);
cout << "The value " << value << " (base 10) " << " is " << factorial;
system("pause");
return 0;
}
string convert(int value, int b)
{
if(b > 9 && b < 1)
{
return 0;
elsereturn convert (value / b, b);
}
}
um....not very complicated code, and have some mistake.
In this case, I don't know the program should consist of a main function together with a recursive function convert. string convert(int value, int b).
And how to check the base.
Please give me some tips.
when calling functions we don't include the return type: string convert( value, b ); should be convert( value, b )
what is that factorial in your cout ?, have you defined that already ?
Remember that string is used for series of characters which is indeed not needed in your code,
isn't int should be the perfect return type of convert instead, since all the values you will need require integers( string is useless )
And you should declare a variable that will hold the data returned by convert