Lessons
C++ · Objects · 53. Defining an Operator

step 1 of 6

Teach me <

sort must know which of two students comes first. I don't know — so you teach me with operator<.

It answers one question: "Do I come before other?" Then sort needs nothing else.

Mission

Make the highest score come first. Change one character, then RUN.

PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
← press me!
readyscreen

Press RUN to see what this program does.

Do the mission and Next turns green.

Defining an Operator