I was wondering if this is possible to do in C++. I have a function that takes user input for x and y bounds and I need to verify it, and it would be easier to do with one function. Is this possible in C++? Here's some pseudocode.
void bounds(char i){
// if i is 'x'
std::cin >> [i]Lower // store to xLower
// verify
}
// then do
bounds('x');
bounds('y');
No, C++ code cannot do anything which depends on the variables name. e.g. If your variable is named x or y, it won't affect the code's behaviour.