# 運算子重載 ``` #include<iostream> #include<string> #include<cstdio> using namespace std; struct student { int grade; int num; char cla[5]; }; bool operator>(student a,student b) { if(a.num>b.num) return true; else return false; } int main() { student a={2,10,"1A"},b={3,14,"2B"}; if(b>a) cout<<"B大"<<endl; } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up