-2

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');
Jeffrey
  • 11,063
  • 1
  • 21
  • 42
Ryan Knutson
  • 108
  • 2
  • 14

1 Answers1

1

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.

Jeffrey
  • 11,063
  • 1
  • 21
  • 42