/*
#include <iostream>
using namespace std;
class circle
{
int radius;
public:
circle(const circle &c);
circle()
{
radius=1;
}
circle(int radius)
{
this->radius=radius;
}
double ga()
{
return 3.14*radius*radius;
}
};
circle::circle(const circle &c)
{
this->radius=c.radius;
cout << "복사생성자 실현" << radius << endl;
}
int main()
{
circle src(30);
circle dest(src);
cout << src.ga()<<endl;
cout << dest.ga() << endl;
}
*/
/*
#include <iostream>
#include <cstring>
using namespace std;
class Person
{
char *name;
int id;
public:
Person(int id,const char *name)
{
this->id=id;
int len=strlen(name);
this->name = new char [len+1];
strcpy(this->name,name);
}
person(const Person &person)
{
this->id = person.id;
int len = strlen(person.name);
this->name = new char [len+1];
strcpy(this->name,person.name);
cout << "복사 생성자 실행 원본 객체 이름 " << this->name << endl;
}
~Person()
{
if (name)
{
delete []name;
}
}
void cn(const char *name)
{
if (strlen(name)>strlen(this->name))
{
return;
}
strcpy(this->name,name);
}
void show()
{
cout << id << ','<< name << endl;
}
};
int main()
{
Person father(1,"Jaemin");
Person daughter(father);
father.show();
daughter.show();
daughter.cn("pig");
father.show();
daughter.show();
}
*/
/*
#include <iostream>
using namespace std;
class circle
{
};
void swap(circle &a,circle &b)
{
circle tmp;
tmp=a;
a=b;
b=tmp;
}
int main()
{
circle c;
circle d;
swap(c,d);
}
*/
/*
#include <iostream>
using namespace std;
void combine(string &t1,string &t2,string &t3)
{
t3=t1+' '+t2;
}
int main()
{
string text1("i love you"),text2("very much");
string text3;
combine(text1,text2,text3);
cout << text3;
}
*/
/*
#include <iostream>
using namespace std;
class circle
{
int radius;
public:
circle(int r)
{
radius=r;
}
int getradius()
{
return radius;
}
void setradius(int r)
{
radius=r;
}
void show()
{
cout << "반지름이 " << radius << "인 원"<< endl;
}
};
void increase (circle &a,circle &b)
{
int k;
k=a.getradius()+b.getradius();
a.setradius(k);
}
int main()
{
circle x(10);
circle y(5);
increase(x,y);
x.show();
}
*/
/*
#include <iostream>
#include <cstring>
using namespace std;
char &find(char a[],char c,bool &success)
{
for (int i=0; i<strlen(a); i++)
{
if (a[i]==c)
{
success=true;
return a[i];
}
}
}
int main()
{
char s[]="Mike";
bool b = false;
char &loc = find (s,'m',b);
if (b==false)
{
cout <<"m을 발견 x" << endl;
}
loc = 'm';
cout << s << endl;
}
*/
#include <iostream>
using namespace std;
class mis
{
int *p;
int size;
int top;
public:
mis()
{
size=1;
}
mis(int size)
{
this->size = size;
}
mis(const mis &s)
{
this->size = s.size;
top=s.top;
this->p=p;
}
~mis()
{
delete p;
}
bool push(int n)
{
top=n;
if (top>n)
{
return false;
}
else if (top<n)
{
return true;
}
}
bool pop(int &n)
{
n=top;
if (top<n)
{
return false;
}
else if (top>n)
{
return true;
}
}
};
int main()
{
mis a(10);
a.push(10);
a.push(20);
mis b=a;
b.push(30);
int n;
a.pop(n);
cout << "스택 a 팝"<< n << endl;
b.pop(n);
cout << "스택 b 팝"<< n << endl;
}