diff --git a/lesson_3/Debug/lesson_3 b/lesson_3/Debug/lesson_3 new file mode 100755 index 0000000..85c73ed Binary files /dev/null and b/lesson_3/Debug/lesson_3 differ diff --git a/lesson_3/Debug/main.d b/lesson_3/Debug/main.d new file mode 100644 index 0000000..32d5ad1 --- /dev/null +++ b/lesson_3/Debug/main.d @@ -0,0 +1,6 @@ +main.o: ../main.cpp ../exercise_1.hpp ../exercise_2.hpp ../exercise_3.hpp \ + ../exercise_4.hpp +../exercise_1.hpp: +../exercise_2.hpp: +../exercise_3.hpp: +../exercise_4.hpp: diff --git a/lesson_3/Debug/main.o b/lesson_3/Debug/main.o new file mode 100644 index 0000000..877cfb0 Binary files /dev/null and b/lesson_3/Debug/main.o differ diff --git a/lesson_3/Debug/makefile b/lesson_3/Debug/makefile new file mode 100644 index 0000000..4ee7c15 --- /dev/null +++ b/lesson_3/Debug/makefile @@ -0,0 +1,57 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: lesson_3 + +# Tool invocations +lesson_3: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: GCC C++ Linker' + g++ -o "lesson_3" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) lesson_3 + -@echo ' ' + +.PHONY: all clean dependents + +-include ../makefile.targets diff --git a/lesson_3/Debug/objects.mk b/lesson_3/Debug/objects.mk new file mode 100644 index 0000000..742c2da --- /dev/null +++ b/lesson_3/Debug/objects.mk @@ -0,0 +1,8 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := + diff --git a/lesson_3/Debug/sources.mk b/lesson_3/Debug/sources.mk new file mode 100644 index 0000000..a7f166f --- /dev/null +++ b/lesson_3/Debug/sources.mk @@ -0,0 +1,27 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +C_UPPER_SRCS := +CXX_SRCS := +C++_SRCS := +OBJ_SRCS := +CC_SRCS := +ASM_SRCS := +CPP_SRCS := +C_SRCS := +O_SRCS := +S_UPPER_SRCS := +CC_DEPS := +C++_DEPS := +EXECUTABLES := +C_UPPER_DEPS := +CXX_DEPS := +OBJS := +CPP_DEPS := +C_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +. \ + diff --git a/lesson_3/Debug/subdir.mk b/lesson_3/Debug/subdir.mk new file mode 100644 index 0000000..c456c4a --- /dev/null +++ b/lesson_3/Debug/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../main.cpp + +OBJS += \ +./main.o + +CPP_DEPS += \ +./main.d + + +# Each subdirectory must supply rules for building sources it contributes +%.o: ../%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/lesson_3/exercise_1.hpp b/lesson_3/exercise_1.hpp new file mode 100644 index 0000000..252dd91 --- /dev/null +++ b/lesson_3/exercise_1.hpp @@ -0,0 +1,106 @@ +/* + * Для расчет площади фигур квадрат/ромб/прямоугольник/параллелограмм + * справедлива будет одна общая формула - произведение основания на высоту + */ + +#ifndef EXERCISE_1_HPP_ +#define EXERCISE_1_HPP_ + +#include + +#define PI 3.14159265358979323846 + +float getRadian(float degree) +{ + return PI / 180 * degree; +} + +class Figure +{ +public: + virtual float area() = 0; + virtual ~Figure() = 0; +}; + +class Parallelogram : public Figure +{ +private: + float m_side_a; + float m_side_b; + float m_height; +protected: + float getSideA() const + { + return m_side_a; + } + + float getSideB() const + { + return m_side_b; + } +public: + Parallelogram(float side_a, float height, float side_b = 0.0) + : m_side_a(side_a), m_side_b(side_b), m_height(height) { } + + float area() + { + float area = m_side_a * m_height; + + std::cout << "Площадь параллелограмма равна " << area << std::endl; + + return area; + } +}; + +class Circle : public Figure +{ + +}; + +class Rectangle : public Parallelogram +{ +public: + Rectangle(float side_a, float side_b) + : Parallelogram(side_a, side_b, side_b) { } + + float area() + { + float area = getSideA() * getSideB(); + + std::cout << "Площадь прямоугольника равна " << area << std::endl; + + return area; + } +}; + +class Square : public Parallelogram +{ + Square(float side_a, float side_b) + : Parallelogram(side_a, side_b, side_b) { } + + float area() + { + float area = getSideA() * getSideB(); + + std::cout << "Площадь квадрата равна " << area << std::endl; + + return area; + } +}; + +class Rhombus : public Parallelogram +{ + Rhombus(float side_a, float side_b) + : Parallelogram(side_a, side_b, side_b) { } + + float area() + { + float area = getSideA() * getSideB(); + + std::cout << "Площадь ромба равна " << area << std::endl; + + return area; + } +}; + +#endif diff --git a/lesson_3/exercise_2.hpp b/lesson_3/exercise_2.hpp new file mode 100644 index 0000000..5c99457 --- /dev/null +++ b/lesson_3/exercise_2.hpp @@ -0,0 +1,8 @@ +#ifndef EXERCISE_2_HPP_ +#define EXERCISE_2_HPP_ + + + + + +#endif diff --git a/lesson_3/exercise_3.hpp b/lesson_3/exercise_3.hpp new file mode 100644 index 0000000..d12de41 --- /dev/null +++ b/lesson_3/exercise_3.hpp @@ -0,0 +1,8 @@ +#ifndef EXERCISE_3_HPP_ +#define EXERCISE_3_HPP_ + + + + + +#endif diff --git a/lesson_3/exercise_4.hpp b/lesson_3/exercise_4.hpp new file mode 100644 index 0000000..ade8be2 --- /dev/null +++ b/lesson_3/exercise_4.hpp @@ -0,0 +1,8 @@ +#ifndef EXERCISE_4_HPP_ +#define EXERCISE_4_HPP_ + + + + + +#endif diff --git a/lesson_3/main.cpp b/lesson_3/main.cpp new file mode 100644 index 0000000..a3019d9 --- /dev/null +++ b/lesson_3/main.cpp @@ -0,0 +1,12 @@ +#include +#include "exercise_1.hpp" +#include "exercise_2.hpp" +#include "exercise_3.hpp" +#include "exercise_4.hpp" + +using namespace std; + +int main() +{ + +}