I'm trying to write a program where it asks for which choice, A or B and after selecting the choice, allows the user to enter a value for that choice. I'm not entirely sure how to go about this, so was wondering if anyone had any insight?
Please use [code][/code] tags and format your code.
I'm not really sure what you're trying to do, but your code doesn't really make sense. The way you're calling get_choice is wrong, the way you're defining it (inside of main) is very much wrong and if you're hoping to change the value stored in choice you won't do it like that. You either would need to call get_choice like this: choice = get_choice(choice) or use a pointer:
1 2 3 4 5 6 7 8 9 10
int* get_choice(int* choice_num) {
int amount;
std::cout << "Enter amount: ";
std::cin >> amount;
std::cout << "\n";
*choice = amount; /* Copy the value of amount into the value pointed by choice. */
return choice_num;
}