I've created two functions that reference each other. My round_to function is supposed to round two floats to the nearest integer, and then my modulo_round function is supposed to reference that function and return floor(x * y) modulo p.
#include <iostream>
#include <cmath>
using namespace std;
int round_to(float x, float y) {
int sum = round(x*y);
return sum;
}
int modulo_round(float x, float y, int p) {
return floor(round_to(x, y)) % p;
}
int main() {
cout << modulo_round(3.12, 3.45, 9);
}
But I'm getting an error that says: error: invalid operands of types '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} and 'int' to binary 'operator%'
Can someone explain what's wrong with my code?