#include <iostream>
using namespace std;
/*
int sum(int a, int b){
int s=0;
for(int i=a; i<=b; i++){
s+=i;
}
return s;
}
int sum(int a){
int s=0;
for(int i=0; i<=a; i++){
s+=i;
}
return s;
}
int main()
{
cout << sum(3, 5) << endl;
cout << sum(3) << endl;
cout << sum(100) << endl;
}
*/
/*
int mul(int a, int b){
int m = 0;
m = a*b;
return m;
}
double mul(double a, double b){
double m=0;
m=a*b;
return m;
}
int main(){
double a;
double b;
cout << "a >> ";
cin >> a;
if( a/(int)a == 1){
a = (int)a;
}
cout << endl << "b >> ";
cin >> b;
if( a/(int)b == 1){
a = (int)b;
}
cout << endl << mul(a,b) << endl;
}
*/
/*
class Person{
public:
int money;
void addMoney(int money){
this->money += money;
}
static int sharedMoney;
static void addShared(int n){
sharedMoney += n;
}
};
int Person::sharedMoney = 10;
int main(){
Person han;
han.money = 100;
han.sharedMoney = 200;
Person lee;
lee.money = 150;
lee.addMoney(200);
lee.addShared(200);
cout << han.money << ' ' << lee.money << endl;
cout << han.sharedMoney << ' ' << lee.sharedMoney << endl;
}
*/
/*
class Circle{
private:
static int numOfCircles;
int radius;
public:
Circle(int r=1);
~Circle(){numOfCircles--;}
double getArea(){return 3.14*radius*radius;}
static int getNumOfCircles(){return numOfCircles;}
};
Circle::Circle(int r){
radius = r;
numOfCircles++;
}
int Circle::numOfCircles = 0;
int main(){
Circle *p = new Circle[10];
cout << "생존하고 있는 원의 개수 = " << Circle::getNumOfCircles() << endl;
delete [] p;
cout << "생존하고 있는 원의 개수 = " << Circle::getNumOfCircles() << endl;
Circle a;
cout << "생존하고 있는 원의 개수 = " << Circle::getNumOfCircles() << endl;
Circle b;
cout << "생존하고 있는 원의 개수 = " << Circle::getNumOfCircles() << endl;
}
*/
/*
class student {
public:
int a, b, c;
};
class school : public student {
};
int main() {
school rs;
rs.a = 10;
}
*/
#include <string>
/*
class Point{
int x;
int y;
public:
void set(int x, int y){
this->x = x;
this->y = y;
}
void showPoint(){
cout << "(" << x << "," << y << ")" << endl;
}
};
class ColorPoint : public Point {
string color;
public:
void setColor(string color){this->color = color;}
void showColorPoint();
};
void ColorPoint::showColorPoint(){
cout << color << ":";
showPoint();
}
int main(){
Point p;
ColorPoint cp;
cp.set(3,4);
cp.setColor("RED");
cp.showColorPoint();
}
*/
/*
class parents {
};
class child : public parents {
};
int main() {
parents *p = new parents;
child *c;
p->a;
p = c;
c = (child*)p;
}
*/
/*
class Point{
protected:
int x;
int y;
public:
void set(int x, int y){
this->x = x;
this->y = y;
}
void setX(int x);
int getX();
void setY(int y);
int getY();
void showPoint(){
cout << "(" << x << "," << y << ")" << endl;
}
};
class ColorPoint : public Point{
string color;
public:
void setColor(string color) {this->color = color;}
void showColorPoint();
bool equals(ColorPoint p);
};
void Point::setX(int a) {
this->x = a;
}
void Point::setY(int b){
this->y = b;
}
void ColorPoint::showColorPoint(){
cout << color << ":";
showPoint();
}
bool ColorPoint::equals(ColorPoint p){
if(x == p.x && y == p.y && color == p.color){
return true;
}
else{
return false;
}
}
int main(){
Point p;
p.set(2,3);
p.setX(5);
p.setY(5);
p.showPoint();
ColorPoint cp;
cp.setX(10);
cp.setY(10);
cp.set(3,4);
cp.setColor("RED");
ColorPoint cp2;
cp2.set(3,4);
cp2.setColor("RED");
cout << ((cp.equals(cp2))?"true :" : "false");
}
*/
class add {
public:
int sum;
add();
add(int a[], int size);
add(int a[], int size, int b[]);
};
add::add(int a[], int size){
int sum = 0;
for(int i=0; i<size; i++){
sum += a[i];
}
this->sum = sum;
}
add::add(int a[], int size, int b[]){
int sum = 0;
for(int i=0; i<size; i++){
sum += a[i] + b[i];
}
this->sum = sum;
}
int main(){
int a[] = {1,2,3,4,5};
int b[] = {6,7,8,9,10};
add x(a,5);
add y(a,5,b);
cout << x.sum << endl;
cout << y.sum << endl;
}