In math, if z = x + y / 2, then z will always change whenever we replace the value of x and y. Can we do that in programming
z = x + y / 2
z
x
y
The closest you probably can get is to create a functor:
#include int main() { int x; int y; auto z = [&x, &y] { return x + y; }; // a lambda capturing x and y while(true) { std::cin >> x; std::cin >> y; std::cout << z() << "\n"; } }