#include
using namespace std;
class Student{
private:
string name;
int rollNumber;
string semester;
double cgpa;
public:
Student(string n,int r,string s,double c )
{name=n;
rollNumber=r;
semester=s;
cgpa=c;
}
Student()
{name="";
rollNumber=0;
semester="Summer 2010";
cgpa=4.0;
}
string get_semester()
{return semester;
}
void set_semester(string n)
{semester=n;
}
void set_roll(int n)
{rollNumber=n;
}
int get_roll()
{return rollNumber;
}
void set_name(string n)
{name=n;
}
string get_name()
{return name;
}
void set_cgpa(double n)
{cgpa=n;
}
double get_cgpa()
{return cgpa;
}
void print()
{cout<<"Student Information\n";
cout<<"Name: "<
cout<<"Roll number: "<
cout<<"Semester: "<
cout<<"Current GPA: "<
}
};
int main()
{Student a;
Student b("name",2345,"Spring 2010",3.5);
a.print();
b.print();
system("pause");
return 0;
}
No comments:
Post a Comment