Problem fractions
User YH
Submission Time 2024-02-29 21:36:18
Score 0
Max Time N/A
Max Memory N/A

Compile Error

fractions.cpp: In function ‘int main()’:
fractions.cpp:23:12: error: no match for ‘operator[]’ (operand types are ‘std::pair<int, int>’ and ‘int’)
23 | fractions[i].first = a;
| ^
fractions.cpp:24:12: error: no match for ‘operator[]’ (operand types are ‘std::pair<int, int>’ and ‘int’)
24 | fractions[i].second = b;
| ^
fractions.cpp:27:27: error: no match for ‘operator+’ (operand types are ‘std::pair<int, int>’ and ‘int’)
27 | sort(fractions, fractions+n, sort_fractions);
| ~~~~~~~~~^~
| | |
| | int
| std::pair<int, int>
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
from /usr/include/c++/9/bits/char_traits.h:39,
from /usr/include/c++/9/ios:40,
from /usr/include/c++/9/ostream:38,