foo.cc: In function ‘bool cmp(stu, stu)’:
foo.cc:8:33: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
8 | return x.s>y.s||x.s==y.s&&x.xh<y.xh;
| ~~~~~~~~^~~~~~~~~~~
foo.cc: In function ‘int main()’:
foo.cc:29:45: error: cannot convert ‘stu’ to ‘int’ in assignment
29 | win[i]=a[2*i];
| ~~~~~^
| |
| stu
foo.cc:30:48: error: cannot convert ‘stu’ to ‘int’ in assignment
30 | lose[i]=a[2*i-1];
| ~~~~~~~^
| |
| stu
foo.cc:35:45: error: cannot convert ‘stu’ to ‘int’ in assignment
35 | win[i]=a[2*i];
| ~~~~~^
| |
| stu
foo.cc:36:48: error: cannot convert ‘stu’ to ‘int’ in assignment
36 | lose[i]=a[i*2-1];
| ~~~~~~~^
| |
| stu
foo.cc:39:22: error: no matching function for call to ‘merge(int*, int*, int*, stu*, bool (&)(stu, stu))’
39 | merge(lose+1,lose+1+n,win+1+n,a+1,cmp);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/algorithm:61,
from stdc++.h:51:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4857:5: note: candidate: ‘template<class _IIter1, class _IIter2, class _OIter> _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter)’
4857 | merge(_InputIterator1 __first1, _InputIterator1 __last1,
| ^~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4857:5: note: template argument deduction/substitution failed:
foo.cc:39:22: note: deduced conflicting types for parameter ‘_IIter2’ (‘int*’ and ‘stu*’)
39 | merge(lose+1,lose+1+n,win+1+n,a+1,cmp);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4908:5: note: candidate: ‘template<class _IIter1, class _IIter2, class _OIter, class _Compare> _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare)’
4908 | merge(_InputIterator1 __first1, _InputIterator1 __last1,
| ^~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4908:5: note: candidate expects 6 arguments, 5 provided