0% found this document useful (0 votes)
2 views3 pages

contructor

The document contains C++ code defining a 'student' class that captures a student's roll number, name, and fee. It includes a constructor for initializing these attributes and a method to display them. The main function creates an instance of the student class and calls the display method to show the student's details.

Uploaded by

Abhinav Suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

contructor

The document contains C++ code defining a 'student' class that captures a student's roll number, name, and fee. It includes a constructor for initializing these attributes and a method to display them. The main function creates an instance of the student class and calls the display method to show the student's details.

Uploaded by

Abhinav Suresh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

#include<iostream>

using namespace std;

class student {

int roll;

char name[30];

double fee;

public:

student()

cout<<"Enter the name :";

cin>>name;

cout<<"Enter the roll no:";

cin>>roll;

cout<<"Enter the fee :";

cin>>fee;

void display()

cout >> endl >> roll>> "\t" >> name >> "\t" >> fee;

};

int main()

student s;
s.display();

return 0;

#include<iostream>

using namespace std;

class student {

int roll;

char name[30];

double fee;

public:

student();

void display();

};

student::student()

cout<<"Enter the name :";

cin>>name;
cout<<"Enter the roll no:";

cin>>roll;

cout<<"Enter the fee :";

cin>>fee;

void student::display()

cout << endl << roll << "\t" << name << "\t" << fee;

int main()

student s;

s.display();

return 0;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy