-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path11.cpp
More file actions
38 lines (32 loc) · 676 Bytes
/
11.cpp
File metadata and controls
38 lines (32 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//WAP to show working of parameterized constructor.
#include<iostream>
#include<string>
//using namespace std;
using std::string;
using std::cout;
using std::cin;
class students
{
public:
string Name;
int rollno;
int age;
students(string x,int y,int z);
void displaydata()
{
cout<< "\n\nStudent Roll No.: "<<rollno << "\nStudent Name: "<<Name << "\nStudent Age: "<<age;
}
};
students::students(string x,int y,int z)
{
Name = x;
rollno = y;
age = z;
}
int main()
{
students one("Sagar", 40, 20 ),two("Mohit", 27, 20 );
one.displaydata();
two.displaydata();
return 0;
}