Untitled
Anonymous
plain_text
01/22/2024 8:41 PM
596 B
16
Indexable
#include<iostream>
using namespace std;
class student{
public:
int id;
double gpa;
void display()
{
cout<<id<<" "<<gpa<<endl;
}
student(int x,double y) {
id = x;
gpa = y;
}
student(){
cout<<"Default constructor"<<endl;
}
};
int main(){
student sonet(056,3.09),cabbo(52,3.56);
sonet.display();
cabbo.display();
return 0;
}Editor is loading...
Leave a Comment