SlideShare a Scribd company logo
//DEBUG-3 //This program creates student objects //and overloads > to compare student gpas
#include<iostream> #include<conio.h> class Student { private: int stuID; int year; double gpa;
public: Student(const int i, const int y, const double g); int operator>(const Student otherStu); };
Student::Student() { stuID=i; year = y; gpa = g; } int operator>(const Student otherStu) { int great; if
(gpa > otherStu) great = 1; return(great); } void main() { Student a(111,2,3.50),b(222,1,3.00);
if(a>b) cout<<"Student a has the higher gpa"<<endl; getch(); }
______________________________
//DEBUG-4 //This program creates student objects //and overloads < to compare student year in
school #include<iostream> #include<conio.h> class Student { private: int stuID; int year; double
gpa; public: Student(const int i, const int y, const double g); void showYear(); Student& <(const
Student otherStu); }; Student::Student(const int i, const int y, const double g) { stuID=i; year = y;
gpa = g; } void Student::showYear() { cout<<year; } Student Student::operator<(const Student
otherStu) { int less = 1; if (year < otherStu.year) less = 1; return(otherStu); } void main() { Student
a(111,2,3.50),b(222,1,3.00); if(a<b) { a.showYear(); cout<<" is less than "; b.showYear(); } else {
a.showYear(); cout<<" is not less than "; b.showYear(); } cout<<endl; getch(); }
using C++

More Related Content

PDF
#include -string- #include -string- #include -vector- #include -iostre (1).pdf
DOC
Pads lab manual final
PDF
Computer science-2010-cbse-question-paper
TXT
Student search by roll no project in c++
PDF
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
PDF
CBSE Question Paper Computer Science with C++ 2011
PDF
Header #include -string- #include -vector- #include -iostream- using.pdf
DOCX
Cs pritical file
#include -string- #include -string- #include -vector- #include -iostre (1).pdf
Pads lab manual final
Computer science-2010-cbse-question-paper
Student search by roll no project in c++
C++ 1.MAIN OBJECTIVEThe goal of this project is to design.pdf
CBSE Question Paper Computer Science with C++ 2011
Header #include -string- #include -vector- #include -iostream- using.pdf
Cs pritical file

Similar to DEBUG3 This program creates student objects and overl.pdf (20)

PDF
C++ normal assignments by maharshi_jd.pdf
PDF
Codes on structures
PDF
C++ practical
PDF
Below is my code for C++- I keep getting an error 43 5 C--Progr.pdf
DOCX
Opp compile
PDF
Ch 4
DOC
Brief Summary Of C++
DOCX
Pratik Bakane C++
DOCX
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
PDF
C- Programming Assignment 4 solution
PDF
OOP_EXPLAINED_example_of_cod_and_explainations.pdf
PPT
Lecture10
PPT
Inheritance (1)
PDF
Unit4_2.pdf
PDF
C++ L09-Classes Part2
PDF
computer science sample papers 2
PDF
Object Oriented Programming (OOP) using C++ - Lecture 3
PPT
C++lecture9
PDF
Program 1 (Practicing an example of function using call by referenc.pdf
PDF
Declaring friend function with inline code
C++ normal assignments by maharshi_jd.pdf
Codes on structures
C++ practical
Below is my code for C++- I keep getting an error 43 5 C--Progr.pdf
Opp compile
Ch 4
Brief Summary Of C++
Pratik Bakane C++
Q2dayOfYear.cppQ2dayOfYear.cpp  Name   Copyright  .docx
C- Programming Assignment 4 solution
OOP_EXPLAINED_example_of_cod_and_explainations.pdf
Lecture10
Inheritance (1)
Unit4_2.pdf
C++ L09-Classes Part2
computer science sample papers 2
Object Oriented Programming (OOP) using C++ - Lecture 3
C++lecture9
Program 1 (Practicing an example of function using call by referenc.pdf
Declaring friend function with inline code

More from motilajain (20)

PDF
Define the following terms related to cellular metabolism M.pdf
PDF
Denegacin de una solicitud Analice la siguiente carta Ide.pdf
PDF
DEN1003 In Class Activity 3 Student Name Date 1 Label th.pdf
PDF
Demo d I 1020 cout ltlt endl ltlt Dl Object .pdf
PDF
Demand P 160 15 Q Total Cost TC 225 Q 2 Part 1 Find.pdf
PDF
def search graph root sequence root visited set .pdf
PDF
Debra notes that Theo Chocolate has started holding its own .pdf
PDF
Demonstrate the effect of the following shocks in the basic .pdf
PDF
Define blood pHDescribe how blood buffer systems contribute.pdf
PDF
Define and give an example of Statistical method a m.pdf
PDF
Define health informatics the key players involved and the.pdf
PDF
Define the following phenomena as acclimatization or adaptat.pdf
PDF
Define a function called helloWorldn that accepts a number.pdf
PDF
Define the exposome a Provide examples of the three broad .pdf
PDF
Define a method printStateInfo that takes two string param.pdf
PDF
DEF Ltd has the following alternative planned activity level.pdf
PDF
def FindNumDigitsnumber return lenstrabsnumber def .pdf
PDF
Deere amp Company is a global manufacturer and distributor.pdf
PDF
Decisions for Tomorrow How much more output per year will ha.pdf
PDF
Declining populations of honeybees and bumblebees is a major.pdf
Define the following terms related to cellular metabolism M.pdf
Denegacin de una solicitud Analice la siguiente carta Ide.pdf
DEN1003 In Class Activity 3 Student Name Date 1 Label th.pdf
Demo d I 1020 cout ltlt endl ltlt Dl Object .pdf
Demand P 160 15 Q Total Cost TC 225 Q 2 Part 1 Find.pdf
def search graph root sequence root visited set .pdf
Debra notes that Theo Chocolate has started holding its own .pdf
Demonstrate the effect of the following shocks in the basic .pdf
Define blood pHDescribe how blood buffer systems contribute.pdf
Define and give an example of Statistical method a m.pdf
Define health informatics the key players involved and the.pdf
Define the following phenomena as acclimatization or adaptat.pdf
Define a function called helloWorldn that accepts a number.pdf
Define the exposome a Provide examples of the three broad .pdf
Define a method printStateInfo that takes two string param.pdf
DEF Ltd has the following alternative planned activity level.pdf
def FindNumDigitsnumber return lenstrabsnumber def .pdf
Deere amp Company is a global manufacturer and distributor.pdf
Decisions for Tomorrow How much more output per year will ha.pdf
Declining populations of honeybees and bumblebees is a major.pdf

Recently uploaded (20)

PDF
Yogi Goddess Pres Conference Studio Updates
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
History, Philosophy and sociology of education (1).pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Yogi Goddess Pres Conference Studio Updates
Supply Chain Operations Speaking Notes -ICLT Program
History, Philosophy and sociology of education (1).pptx
Final Presentation General Medicine 03-08-2024.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Complications of Minimal Access Surgery at WLH
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Weekly quiz Compilation Jan -July 25.pdf
Computing-Curriculum for Schools in Ghana
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Orientation - ARALprogram of Deped to the Parents.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Microbial disease of the cardiovascular and lymphatic systems
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Module 4: Burden of Disease Tutorial Slides S2 2025
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Final Presentation General Medicine 03-08-2024.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf

DEBUG3 This program creates student objects and overl.pdf

  • 1. //DEBUG-3 //This program creates student objects //and overloads > to compare student gpas #include<iostream> #include<conio.h> class Student { private: int stuID; int year; double gpa; public: Student(const int i, const int y, const double g); int operator>(const Student otherStu); }; Student::Student() { stuID=i; year = y; gpa = g; } int operator>(const Student otherStu) { int great; if (gpa > otherStu) great = 1; return(great); } void main() { Student a(111,2,3.50),b(222,1,3.00); if(a>b) cout<<"Student a has the higher gpa"<<endl; getch(); } ______________________________ //DEBUG-4 //This program creates student objects //and overloads < to compare student year in school #include<iostream> #include<conio.h> class Student { private: int stuID; int year; double gpa; public: Student(const int i, const int y, const double g); void showYear(); Student& <(const Student otherStu); }; Student::Student(const int i, const int y, const double g) { stuID=i; year = y; gpa = g; } void Student::showYear() { cout<<year; } Student Student::operator<(const Student otherStu) { int less = 1; if (year < otherStu.year) less = 1; return(otherStu); } void main() { Student a(111,2,3.50),b(222,1,3.00); if(a<b) { a.showYear(); cout<<" is less than "; b.showYear(); } else { a.showYear(); cout<<" is not less than "; b.showYear(); } cout<<endl; getch(); } using C++