-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent.cpp
More file actions
55 lines (41 loc) · 971 Bytes
/
student.cpp
File metadata and controls
55 lines (41 loc) · 971 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<iostream>
using namespace std;
class Student
{
string name;
int id;
int div;
int PhoneNumber;
public:
Student()
{
cout<<"Hey, Welcome "<<endl;
}
void setName(string name , int id , int div , int PhoneNumber)
{
this->name = name;
this->div = div;
this->id = id;
if(PhoneNumber.length() <= 10)
{
this->PhoneNumber = PhoneNumber;
cout<<this->PhoneNumber<<endl;
}
else{
cout<<"Invalid Number"<<endl;
}
}
void print()
{
cout<<"Name of the Student : "<<this->name<<endl;
cout<<"ID of the Student : "<<this->id<<endl;
cout<<"Div of the Student : "<<this->div<<endl;
cout<<"PhoneNumber of the Student : "<<this->PhoneNumber<<endl;
}
};
int main()
{
Student s1;
s1.setName("Rajeev" , 32 , 8 , 9528629522);
s1.print();
}