Category Archives: C++ Programming

Handling complex number using C++ class

#ifndef COMPLEX_H #define COMPLEX_H #include <iostream> #include <fstream> #include <string> #include <complex> class Complex { private: double real; double imag; public: Complex(); Complex(const Complex& obj); Complex(const std::string& str); Complex(double real); Complex(double real, double imag); double real_num() const; double imag_num() const; std::string toString() const; Complex operator+(const Complex& rhs) const; Complex operator-(const Complex& rhs) const; Complex operator*(const … Continue reading Handling complex number using C++ class

Sliding Block Puzzle Solver(2×3, 3×2, 3×3) – C++ Programming

A program written in c language to solve a 2×3, 3×2, 3×3 sliding block puzzle. 1. DFS (Brute-Force)We can perform depth-first search on state space (Set of all configurations of a given problem i.e. all states that can be reached from initial state) tree. Image source: https://courses.cs.washington.edu In this solution, successive moves can take us away … Continue reading Sliding Block Puzzle Solver(2×3, 3×2, 3×3) – C++ Programming