Files
strangecpp/cpplinker/09_debug_linker/main.cpp
Pratchaya Khansomboon 7353c470a6 Add examples for different utilities
Change-Id: I7ba2435c9ffaa10ccb67a87693ac961a26341ffe
2026-02-24 13:46:16 +01:00

27 lines
873 B
C++

#include "math_lib.hpp"
#include <iostream>
int main() {
// --- Free functions ---
std::cout << "=== Free functions ===\n";
std::cout << "Math::sqrt(2.0) = " << Math::sqrt(2.0) << "\n";
std::cout << "Math::square(5.0) = " << Math::square(5.0) << "\n";
std::cout << "Math::cube(3.0) = " << Math::cube(3.0) << "\n";
// --- Vector2D ---
std::cout << "\n=== Vector2D ===\n";
Math::Vector2D v1(3.0, 4.0);
Math::Vector2D v2(1.0, 2.0);
std::cout << "v1.length() = " << v1.length() << "\n";
Math::Vector2D sum = v1.add(v2);
std::cout << "v1.add(v2) = (" << sum.x << ", " << sum.y << ")\n";
Math::Vector2D scaled = v1.scale(2.0);
std::cout << "v1.scale(2.0) = (" << scaled.x << ", " << scaled.y << ")\n";
std::cout << "v1.dot(v2) = " << v1.dot(v2) << "\n";
return 0;
}