1. #include using namespace std; class Circle { int radius; public: Circle() { radius = 1; } Circle(int r) { radius = r; } void setRadius(int r) { radius = r; } double getArea(); }; double Circle::getArea() { return 3.14*radius*radius; } int main() { Circle circles[2][3]; circles[0][0].setRadius(1); circles[0][1].setRadius(2); circles[0][2].setRadius(3); circles[1][0].setRadius(4); circles[1][1]..
#include using namespace std; bool equalArray(int *p, int *q, int size); int main() { int a[] = { 1,2,3,4,5 }; int b[] = { 1,2,3,4,5 }; if (equalArray(a, b, 5)) cout
1. #include using namespace std; class Power { int kick; int punch; public: Power(int kick = 0, int punch = 0) { this->kick = kick; this->punch = punch; } void show(); Power operator+ (Power op2); Power operator-(Power op3); }; void Power::show() { cout
# Oval.h #ifndef Oval_H #define Oval_H class Oval { private: int width, height; public: Oval(); Oval(int w, int h); ~Oval(); int getWidth(); int getHeight(); void set(int w, int h); void show(); }; #endif #pragma once # Oval.cpp #include using namespace std; #include "Oval.h" Oval::Oval() :width(1), height(1) {} Oval::Oval(int w, int h) : width(w), height(h) {} Oval::~Oval() { cout
# Adder.h #ifndef ADDER_H #define ADDER_H class Adder { int op1, op2; public: Adder(int a, int b); int process(); }; #endif #pragma once # Adder.cpp #include "Adder.h" Adder::Adder(int a, int b) { op1 = a; op2 = b; } int Adder::process() { return op1 + op2; } # Calculator.h #ifndef CALCULATOR_H #define CALCULATOR_H class Calculator { public: void run(); }; #endif #pragma once # Calculator.cpp #i..
# Circle.h #ifndef CIRCLE_H #define CIRCLE_H class Circle { private: int radius; public: Circle(); Circle(int r); double getArea(); }; #endif # Circle.cpp #include using namespace std; #include "Circle.h" Circle::Circle() { radius = 1; cout
#include using namespace std; class Rectangle { private: int width, height; public: Rectangle(int w, int h); int getArea(); }; Rectangle::Rectangle(int w, int h) : width(w), height(h) {} int Rectangle::getArea() { return width * height; } int main() { int x, y; cout > x >> y; Rectangle rect(x,y); cout
#include #include using namespace std; int main() { char c[100]; cout > c; for (int i = 0; i < strlen(c); i++) { for (int j = 0; j
#include #include using namespace std; int main() { string name, address, age; cout
#include #include using namespace std; int main() { string s1, s2; cout
#include using namespace std; char& find(char a[], char c, bool& success); int main() { char s[] = "Mike"; bool b = false; char& loc = find(s, 'M', b); cout
#include using namespace std; class Accumulator { int value; public: Accumulator(int value) { this->value = value; }; Accumulator& add(int n); int get() { return value; }; }; Accumulator& Accumulator::add(int n) { value += n; return *this; } int main() { Accumulator acc(10); acc.add(5).add(6).add(7); cout
#include using namespace std; class Dept { int size; int *scores; public: Dept(int size) { this->size = size; scores = new int[size]; } Dept(const Dept&dept); ~Dept(); int getSize() { return size; } void read(); bool isOver60(int index); }; Dept::Dept(const Dept&dept) { this->size = dept.size; scores = new int[size]; for (int i = 0; i scores[i] = dept.scores[i]; } Dept::~Dept(..