bal.cpp: In function 'int main()':
bal.cpp:27:17: error: 'r' was not declared in this scope
27 | cout << r << endl;
| ^
bal.cpp:28:16: error: no matching function for call to 'std::stack<std::pair<double, double> >::push(<brace-enclosed initializer list>)'
28 | st.push({xpos, r});
| ~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/13/stack:63,
from bal.cpp:2:
/usr/include/c++/13/bits/stl_stack.h:260:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<double, double>; _Sequence = std::deque<std::pair<double, double>, std::allocator<std::pair<double, double> > >; value_type = std::pair<double, double>]'
260 | push(const value_type& __x)
| ^~~~
/usr/include/c++/13/bits/stl_stack.h:260:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::stack<std::pair<double, double> >::value_type&' {aka 'const std::pair<double, double>&'}
260 | push(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_stack.h:265:7: note: candidate: 'void std::stack<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<double, double>; _Sequence = std::deque<std::pair<double, double>, std::allocator<std::pair<double, double> > >; value_type = std::pair<double, double>]'
265 | push(value_type&& __x)
| ^~~~
/usr/include/c++/13/bits/stl_stack.h:265:25: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::stack<std::pair<double, double> >::value_type&&' {aka 'std::pair<double, double>&&'}
265 | push(value_type&& __x)
| ~~~~~~~~~~~~~^~~