Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
445 B
3
Indexable
Never
#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;
}
Leave a Comment