In the following code the expression can not be evaluated since the compiler gives me an error
#include <iostream>
int main()
{
std::cout<< "Welcome\nto\n\nc++!\n";
// std::cout<< "to c++ ! \n";
double a=2;
double b=2;
double c=3;
double d=4;
double e=5;
double f=6;
double sum;
sum=(a*b%c+d/e-f); // error: invalid operand of types double and double to binary operators%
std::cout <<"Sum is:" << (float) sum;
return 0;
}
I know that the fmod(x,y) function can be used on doubles but the expression won't remain the same,is there some other way I can do it or I need to make an expression evaluator myself.If so then how?I am new to C++ please help and why isn't the compiler intelligent enough though?