I don't see why you need the inner do/while loop. The logic for the while condition of the inner while loop is wrong since answer can only have one value at a time and using the logic you have will only be true if ans has more than one value at a time.
choice is a string but amount is a double, though now that I reread your origninal post you probably aren't looking for data validation. sorry.
It looks like what you want to do is to use a default. The routine for that is something like this;
int choice;
cout << "select one of the following using the number of the line listed" << endl;
cout << "1) withdrawal" << endl;
cout << "2) deposit" << endl;
cin >> choice;
do
{
if(choice == 1)
//do this
else if(choice == 2)
//do that
else //this is the default to catch any input thats wrong
//do something else
cout << "go again y/n" << endl;
char s;
cin >> s;
}while(s == 'y')
Often, instead of a series of if/else if/else statements a switch statement is used like thisl
switch(choice)
{
case 1:
//do this
break;
case 2:
//do that
break;
default:
//do something else
break;
}
but if you've never heard of switch statements before, then the sequential if/else statement work, too.
Oops, I see tostrinj already posted the switch option.