fork download
  1. #include<iostream>
  2. using namespace std;
  3. class Student{
  4. string name;
  5. double cg;
  6. public:
  7. Student(string n="", double c=0.0): name(n), cg(c){}
  8.  
  9. bool operator>(Student s){
  10. return cg>s.cg;
  11. }
  12. bool operator==(Student s){
  13. return cg==s.cg;
  14. }
  15.  
  16. };
  17.  
  18. int main(){
  19. Student s1("Nadim", 3.80);
  20. Student s2("Nafi", 3.70);
  21. if(s1>s2){
  22. cout<<"Nadim will be project leader\n";
  23. }
  24. else if(s1==s2){
  25. cout<<"Both will be leader\n";
  26. }
  27. else{
  28. cout<<"Nafi will be leader\n";
  29. }
  30. }
  31.  
  32.  
  33.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Nadim will be project leader