I have an errors here that I am trying to clear. I am using Dev-C++ to build this program. Obviously I am new to this.
The errors I am receiving;
38. error: invalid operands of types `double' and `double' to binary `operator%'
Execution terminated
If anyone could help me clear this error I would appreciate it very much.
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
double quarters = 0;
double dimes = 0;
double nickels = 0;
double pennies = 0;
double cents = 0;
quarters =.25;
dimes = .10;
nickels = .5;
pennies = .01;
cents = 2.03;
double counter = 0;
counter = 5.00-2.97;
cout << "Change due " << counter << endl;
counter = quarters % cents;
cout << "Quarters due " << counter << endl;
system("pause");
return 0;
}
Last edited on
You can not use % with doubles.
Alternatively you can use fmod
which is included inside of <math.h>
your post is missing the end of your program.
Please repost and use code tags.
Last edited on