SlideShare a Scribd company logo
1 of 7
1 | P a g e
CS-212 Object Oriented Programming
National University of Sciences and Technology
School of Electrical Engineering and Computer Science
CS-212 Object Oriented Programming
LAB No. 02
Section: BEE 12-C
Submitted to: Ms. Shakeela Bibi
Instructor: Dr. Khuram Shahzad
Name CMS ID
Ahamed Musharaf 356481
2 | P a g e
CS-212 Object Oriented Programming
LAB TASKS
Task
Develop a program that implements a C++ class “Student” with following data members
 Age
 Roll Number
 markSubject1
 marksSubject2
 marksSubject3
The class should define a method/function to calculate percentage from marks obtained in three subjects.
Finally, you’ll create objects of Student class, initialize their data members through set and get functions,
calculate percentages, determine grades and print summary in the end.
Code:
//The given code defines a class Student
//The function getinfo() accepts the age,student roll no, and marks of three subjects
from the user and putdata() display this information.
#include <iostream>
#include <stdio.h>
using namespace std;
//Class which contains the attributes of Students
class student
{
private:
int age, rollno;
int m1, m2, m3;
public:
void getinfo() //getting info from user about the student
{
cout << "Enter Student Age: ";
cin >> age;
cout << "Enter Student Roll No: ";
cin >> rollno;
cout << "Enter the marks obtained in Subject1: ";
cin >> m1;
cout << "Enter the marks obtained in Subject2: ";
3 | P a g e
CS-212 Object Oriented Programming
cin >> m2;
cout << "Enter the marks obtained in Subject3: ";
cin >> m3;
}
//calculating percentage
float getPercentage()
{
float percentage;
//converting the integer percentage calculated into float percentage using
static_cast function
percentage = static_cast <float>(m1 + m2 + m3) / 3;
return percentage;
}
//calculating the Grade obtained by the student
char getGrade()
{
char grade;
float percentage = getPercentage();
if (percentage < 40) {
return 'F';
}
else if (percentage < 50) {
return 'D';
}
else if (percentage < 60) {
return 'C';
}
else if (percentage < 75) {
return 'B';
}
else {
return 'A';
}
}
void putdata() // to get the summary
{
cout << "Age: " << age << endl;
cout << "Roll number: " << rollno << endl;
cout << "Marks obtained in Subject1: " << m1 << endl;
cout << "Marks obtained in Subject2: " << m2 << endl;
cout << "Marks obtained in Subject3: " << m3 << endl;
cout << "Percentage: " << getPercentage() << endl;
cout << "Grade obtained: " << getGrade() << endl;
}
};
int main() {
//student object s1 and s2 created in main
4 | P a g e
CS-212 Object Oriented Programming
//The age, roll no, and marks are ontained from the user by using the class
student
student s1;
student s2;
cout << "Enter below the details of the student Ahamed," << endl;
s1.getinfo();
cout << "n";
cout << "Enter below the details of the student Musharaf," << endl;
s2.getinfo();
cout << "n";
//displaying the percentage and grade of both the students using the created
getPercentage and getGrade functions
cout << "Ahamed's percentage is: " << s1.getPercentage() << endl;
cout << "Musharaf's percentage is: " << s2.getPercentage() << endl;
cout << "n";
cout << "Ahamed's grade is: " << s1.getGrade() << endl;
cout << "Musharaf's grade is: " << s2.getGrade() << endl;
cout << "n";
//Display of summary of both the students
cout << "Ahamed's summary: " << endl;
s1.putdata();
cout << "n";
cout << "Musharaf's summary: " << endl;
s2.putdata();
return 0;
}
5 | P a g e
CS-212 Object Oriented Programming
6 | P a g e
CS-212 Object Oriented Programming
Output:
7 | P a g e
CS-212 Object Oriented Programming

More Related Content

What's hot

What's hot (18)

More on Data Types (Exponential and Scientific Notations)
More on Data Types (Exponential and Scientific Notations)More on Data Types (Exponential and Scientific Notations)
More on Data Types (Exponential and Scientific Notations)
 
matab no3
matab no3matab no3
matab no3
 
Tcs nqt 2019 p 2
Tcs nqt 2019 p 2Tcs nqt 2019 p 2
Tcs nqt 2019 p 2
 
Resume
ResumeResume
Resume
 
Python programs
Python programsPython programs
Python programs
 
Pascal for beginers tute
Pascal for beginers   tutePascal for beginers   tute
Pascal for beginers tute
 
Code Optimizatoion
Code OptimizatoionCode Optimizatoion
Code Optimizatoion
 
201505 CSE340 Lecture 04
201505 CSE340 Lecture 04201505 CSE340 Lecture 04
201505 CSE340 Lecture 04
 
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHMCLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
 
201505 CSE340 Lecture 03
201505 CSE340 Lecture 03201505 CSE340 Lecture 03
201505 CSE340 Lecture 03
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
 
201505 - CSE340 Lecture 01
201505 - CSE340 Lecture 01201505 - CSE340 Lecture 01
201505 - CSE340 Lecture 01
 
Case study3
Case study3Case study3
Case study3
 
Write programs to solve problems pascal programming
Write programs to solve problems   pascal programmingWrite programs to solve problems   pascal programming
Write programs to solve problems pascal programming
 
201506 CSE340 Lecture 10
201506 CSE340 Lecture 10201506 CSE340 Lecture 10
201506 CSE340 Lecture 10
 
halstead software science measures
halstead software science measureshalstead software science measures
halstead software science measures
 
Evaluation of postfix expression using stack
Evaluation of postfix expression using stackEvaluation of postfix expression using stack
Evaluation of postfix expression using stack
 
Lab no.06
Lab no.06Lab no.06
Lab no.06
 

Similar to LAB 2 Report.docx

CCE management system
CCE management systemCCE management system
CCE management systemTrish004
 
22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdf22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdfPradipShinde53
 
Can someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdfCan someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdfAmansupan
 
Abstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling JavaAbstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling JavaSyedShahroseSohail
 
#include -string- #include -string- #include -vector- #include -iostre (1).pdf
#include -string- #include -string- #include -vector- #include -iostre (1).pdf#include -string- #include -string- #include -vector- #include -iostre (1).pdf
#include -string- #include -string- #include -vector- #include -iostre (1).pdfashiyanabakersandcon
 
How to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programmingHow to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programmingSyed Faizan Hassan
 
Online_Examination
Online_ExaminationOnline_Examination
Online_ExaminationRupam Dey
 
computer science project
computer science projectcomputer science project
computer science projectRoshan Bastia
 
DEBUG3 This program creates student objects and overl.pdf
DEBUG3 This program creates student objects and overl.pdfDEBUG3 This program creates student objects and overl.pdf
DEBUG3 This program creates student objects and overl.pdfmotilajain
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYRadha Maruthiyan
 
How to implement g rpc services in nodejs
How to implement g rpc services in nodejsHow to implement g rpc services in nodejs
How to implement g rpc services in nodejsKaty Slemon
 
GPA calculator and grading program in c++
GPA calculator and grading program in c++GPA calculator and grading program in c++
GPA calculator and grading program in c++Taimur Muhammad
 
Investigatory Project for Computer Science
Investigatory Project for Computer Science Investigatory Project for Computer Science
Investigatory Project for Computer Science Sonali Sinha
 
Lec_15_OOP_ObjectsAsParametersFriendClasses.pdf
Lec_15_OOP_ObjectsAsParametersFriendClasses.pdfLec_15_OOP_ObjectsAsParametersFriendClasses.pdf
Lec_15_OOP_ObjectsAsParametersFriendClasses.pdfAneesAbbasi14
 

Similar to LAB 2 Report.docx (20)

Report-Template.docx
Report-Template.docxReport-Template.docx
Report-Template.docx
 
CCE management system
CCE management systemCCE management system
CCE management system
 
22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdf22316-2019-Summer-model-answer-paper.pdf
22316-2019-Summer-model-answer-paper.pdf
 
Can someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdfCan someone help me with this code When I run it, it stops after th.pdf
Can someone help me with this code When I run it, it stops after th.pdf
 
Abstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling JavaAbstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling Java
 
#include -string- #include -string- #include -vector- #include -iostre (1).pdf
#include -string- #include -string- #include -vector- #include -iostre (1).pdf#include -string- #include -string- #include -vector- #include -iostre (1).pdf
#include -string- #include -string- #include -vector- #include -iostre (1).pdf
 
How to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programmingHow to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programming
 
Online_Examination
Online_ExaminationOnline_Examination
Online_Examination
 
computer science project
computer science projectcomputer science project
computer science project
 
12Structures.pptx
12Structures.pptx12Structures.pptx
12Structures.pptx
 
DEBUG3 This program creates student objects and overl.pdf
DEBUG3 This program creates student objects and overl.pdfDEBUG3 This program creates student objects and overl.pdf
DEBUG3 This program creates student objects and overl.pdf
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 
OOPS 22-23 (1).pptx
OOPS 22-23 (1).pptxOOPS 22-23 (1).pptx
OOPS 22-23 (1).pptx
 
How to implement g rpc services in nodejs
How to implement g rpc services in nodejsHow to implement g rpc services in nodejs
How to implement g rpc services in nodejs
 
College management
College managementCollege management
College management
 
GPA calculator and grading program in c++
GPA calculator and grading program in c++GPA calculator and grading program in c++
GPA calculator and grading program in c++
 
Lecture07
Lecture07Lecture07
Lecture07
 
Inheritance.pptx
Inheritance.pptxInheritance.pptx
Inheritance.pptx
 
Investigatory Project for Computer Science
Investigatory Project for Computer Science Investigatory Project for Computer Science
Investigatory Project for Computer Science
 
Lec_15_OOP_ObjectsAsParametersFriendClasses.pdf
Lec_15_OOP_ObjectsAsParametersFriendClasses.pdfLec_15_OOP_ObjectsAsParametersFriendClasses.pdf
Lec_15_OOP_ObjectsAsParametersFriendClasses.pdf
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

LAB 2 Report.docx

  • 1. 1 | P a g e CS-212 Object Oriented Programming National University of Sciences and Technology School of Electrical Engineering and Computer Science CS-212 Object Oriented Programming LAB No. 02 Section: BEE 12-C Submitted to: Ms. Shakeela Bibi Instructor: Dr. Khuram Shahzad Name CMS ID Ahamed Musharaf 356481
  • 2. 2 | P a g e CS-212 Object Oriented Programming LAB TASKS Task Develop a program that implements a C++ class “Student” with following data members  Age  Roll Number  markSubject1  marksSubject2  marksSubject3 The class should define a method/function to calculate percentage from marks obtained in three subjects. Finally, you’ll create objects of Student class, initialize their data members through set and get functions, calculate percentages, determine grades and print summary in the end. Code: //The given code defines a class Student //The function getinfo() accepts the age,student roll no, and marks of three subjects from the user and putdata() display this information. #include <iostream> #include <stdio.h> using namespace std; //Class which contains the attributes of Students class student { private: int age, rollno; int m1, m2, m3; public: void getinfo() //getting info from user about the student { cout << "Enter Student Age: "; cin >> age; cout << "Enter Student Roll No: "; cin >> rollno; cout << "Enter the marks obtained in Subject1: "; cin >> m1; cout << "Enter the marks obtained in Subject2: ";
  • 3. 3 | P a g e CS-212 Object Oriented Programming cin >> m2; cout << "Enter the marks obtained in Subject3: "; cin >> m3; } //calculating percentage float getPercentage() { float percentage; //converting the integer percentage calculated into float percentage using static_cast function percentage = static_cast <float>(m1 + m2 + m3) / 3; return percentage; } //calculating the Grade obtained by the student char getGrade() { char grade; float percentage = getPercentage(); if (percentage < 40) { return 'F'; } else if (percentage < 50) { return 'D'; } else if (percentage < 60) { return 'C'; } else if (percentage < 75) { return 'B'; } else { return 'A'; } } void putdata() // to get the summary { cout << "Age: " << age << endl; cout << "Roll number: " << rollno << endl; cout << "Marks obtained in Subject1: " << m1 << endl; cout << "Marks obtained in Subject2: " << m2 << endl; cout << "Marks obtained in Subject3: " << m3 << endl; cout << "Percentage: " << getPercentage() << endl; cout << "Grade obtained: " << getGrade() << endl; } }; int main() { //student object s1 and s2 created in main
  • 4. 4 | P a g e CS-212 Object Oriented Programming //The age, roll no, and marks are ontained from the user by using the class student student s1; student s2; cout << "Enter below the details of the student Ahamed," << endl; s1.getinfo(); cout << "n"; cout << "Enter below the details of the student Musharaf," << endl; s2.getinfo(); cout << "n"; //displaying the percentage and grade of both the students using the created getPercentage and getGrade functions cout << "Ahamed's percentage is: " << s1.getPercentage() << endl; cout << "Musharaf's percentage is: " << s2.getPercentage() << endl; cout << "n"; cout << "Ahamed's grade is: " << s1.getGrade() << endl; cout << "Musharaf's grade is: " << s2.getGrade() << endl; cout << "n"; //Display of summary of both the students cout << "Ahamed's summary: " << endl; s1.putdata(); cout << "n"; cout << "Musharaf's summary: " << endl; s2.putdata(); return 0; }
  • 5. 5 | P a g e CS-212 Object Oriented Programming
  • 6. 6 | P a g e CS-212 Object Oriented Programming Output:
  • 7. 7 | P a g e CS-212 Object Oriented Programming