First of all, next time you post your code, please use the code tags. They show up as "<>" in the Format box to the right.
As far as your code. In the line:
if(argc=3)
You are actually assigning 3 to arg. This will always return true, so you will always execute the following lines. You want the comparison operator "==".
In the line:
char base = atoi(argv[2]);
You are converting argv[2] trying to an integer value and placing it into a char variable. This is legal, but it's not what you want.
After you output "X", you make a bunch of declarations/assignments, and do nothing with them, so I don't know what you are trying to do with them.
To answer your specific question, you must take argv[2] and treat it as a char*. After you verify that the first character is 'b', then start at the second character and convert it to an integer. Something like:
1 2 3 4 5 6 7 8 9
|
char* bVar = argv[2];
int bVal;
if (bVar[0] == 'b')
{
bVal = atoi(bVar + 1);
cout << "bVal = " << bVal << endl;
}
else
{...}
|
(Before you are done you should also verify that all characters after the first are digits, but for now just assume the format is correct.)