Wednesday, 19 May 2021

CPP-sLIP27A

 Create a C++ class College, with data members College_Id, College_Name, Establishment_year, University _Name. Overload operators>> and << to accept and display College information.

#include<iostream.h>

#include<conio.h>

class college

{

int cid,year;

char cname[10],uname[10];

public:

friend istream &operator>>(istream &scan,college &d)

{

cout<<"Enter the College Details\n";

scan>>d.cid>>d.year>>d.cname>>d.uname;

return scan;

}

friend ostream &operator<<(ostream &print,college &d)

{

print<<d.cid<<"\n"<<d.year<<"\n"<<d.cname<<"\n"<<d.uname;

return print;

}

};

void main()

{

college dd;

clrscr();

cin>>dd;

cout<<"\ncollege Details: -";

cout<<dd;

getch();

}