-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.cpp
More file actions
79 lines (53 loc) · 969 Bytes
/
Copy pathdemo.cpp
File metadata and controls
79 lines (53 loc) · 969 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include<iostream>
#include<string>
using namespace std;
class student{
int id;
int rollno,marks;
string name;
friend void getget( student&);
public:
static int count;
//.count++;
student(){
cout<<"constructor is called. enter id";
cin>>id;
}
//student(int i){
//cout<<"constructor is called.";
//id=i;
//}
void getinfo();
void setinfo(){
cout<<"enter roll no";
cin>>rollno;
cout<<"enter marks";
cin>>marks;
cout<<"enter name";
getline(cin,name);
cout<<endl;
getinfo();
}
};
void student :: getinfo(){
cout<< id<<endl<<rollno<<endl<<marks<<endl;
int size=name.length();
int j=0;
for(j=0;j<(size);j=j+1){
cout<<name[j];
}
cout<<endl;
}
int student :: count;
void getget(student &s1){
cout<<endl<<"getinfo part2"<<endl;
cout<<s1.id<<endl<<s1.rollno<<endl<<s1.marks<<endl;
cout<<s1.name;
}
int main(){
student s1;
//student s2(4);
s1.setinfo();
getget(s1);
return 0;
}