top of page

// math_operations.h

 

#ifndef MATH_OPERATIONS_H

#define MATH_OPERATIONS_H

 

// Declaraciones de funciones para operaciones matemáticas

int suma(int a, int b);

int resta(int a, int b);

int multiplicacion(int a, int b);

float division(int a, int b);

 

#endif // MATH_OPERATIONS_H

// string_operations.h

 

#ifndef STRING_OPERATIONS_H

#define STRING_OPERATIONS_H

 

#include <string>

 

// Declaraciones de funciones para operaciones con cadenas

std::string concatenar(const std::string& str1, const std::string& str2);

int longitud(const std::string& str);

bool esPalindromo(const std::string& str);

 

#endif // STRING_OPERATIONS_H

// // math_operations.cpp

 

#include "math_operations.h"

 

int suma(int a, int b) {

    return a + b;

}

 

int resta(int a, int b) {

    return a - b;

}

 

int multiplicacion(int a, int b) {

    return a * b;

}

 

float division(int a, int b) {

    if (b != 0) {

        return static_cast<float>(a) / b;

    } else {

        // Manejar la división por cero según sea necesario

        return 0.0;

    }

}

bottom of page