Add examples for different utilities
This commit is contained in:
27
cpplinker/10_debug_linker/main.cpp
Normal file
27
cpplinker/10_debug_linker/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user