-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignment31.cpp
121 lines (111 loc) · 1.93 KB
/
assignment31.cpp
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//pointer concept
/*#include<iostream>
using namespace std;
class demo
{
int num;
public:
void setdata(int v)
{
num=v;
}
demo(){}
demo * operator=(demo v)
{
return this;
}
};
int main()
{
demo d,d1;
demo *d3;
d.setdata(5);
d3=d=d1;
}*/
//Vactor concept...............................
/*#include<iostream>
using namespace std;
class abc
{
int x;
public:
abc(int a)
{
cout<<"parameterized constructor call\n";
x=a;
showdata();
}
void showdata()
{
cout<<"x==>"<<x<<"\n";
}
};
class list{
int x;
const int y;//value fix rehse bdha object mate
const int c=10;
int &z;
abc a1;
public:
list(int x,int y):x(x),y(y),z(y),a1(45)//const ni value change thase
//y(printf("first \n")),x(printf("second\n"))//x(a),y(x)////
{
//y=b;wrong
//z=b;wrong
//a1=5;wrong
}
void showdata()
{
cout<<"x = :"<<x<<" y = :"<<y<<" z = :"<<z<<" c =: "<<c<<"\n";
}
};
int main()
{
list l(4,9);
list l2(4,7);
l.showdata();
l2.showdata();
}*/
//pointer concept
/*#include<iostream>
using namespace std;
class complex
{
int real,img;
public:
void setdata(int real,int img)
{
this->real=real;
this->img=img;
}
void showdata()
{
cout<<"real -->"<<real<<"img -->"<<img<<"\n";
}
complex sumgrater(complex c1)
{
if ((real+img)>(c1.img+c1.real))
{
return *this;
}
else
{
return c1;
}
}
};
void inputdata(complex * p)
{
int x,y;
cout<<"enter two numbwer";
cin>>x>>y;
p->setdata(x,y);
}
int main()
{
complex c,c2,c3;
inputdata(&c);
c.showdata();
c2.setdata(5,7);
c3=c.sumgrater(c2);//sum of both variable is grater
}*/