-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexam 07.cpp
More file actions
52 lines (41 loc) · 898 Bytes
/
exam 07.cpp
File metadata and controls
52 lines (41 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//A class name intake 51.
// A nonmember function will compare the highest CGPA of two students
// and return which student has highest CGPA.
// A member function will display the student name who
// got the highest CGPA and his CGPA. Now implement the class.
#include<iostream>
using namespace std;
class intake51
{
public:
double cgpa;
string name;
intake51 (double a, string b)
{
cgpa = a;
name = b;
}
};
float l(intake51 o,intake51 p)
{
if(o.cgpa>p.cgpa)
{
cout << o.name;
}
else {cout<<p.name;}
}
int main ()
{
intake51 ob1(7.33,"Mursalin");
intake51 ob2(5.55,"Kabir");
if(ob1.cgpa>ob2.cgpa)
{
cout << ob1.name<<endl<<ob1.cgpa;
}
else
{
cout << ob2.name <<endl<<ob2.cgpa;
}
l(ob1,ob2);
return 0;
}