Maynza
Formerly DontdroptheSOAD
Rounding.
Won't compile because:
10 C:\Documents and Settings\zachary maynard\Desktop\assignment1.cpp invalid operands of types `double' and `int' to binary `operator%'
But it is the same if I use 1.0.
Why can't I use % with doubles?
Code:
#include <iostream>
using namespace std;
int main()
{
int q, c;
double tunumber, i;
cout<<"Enter the number you are too stupid to round.\n";
cin>>tunumber;
i = tunumber % 1;
if( i <= 5 )
{
c = tunumber;
}
else
{
c = ++tunumber;
}
cout<<c;
cin>>q;
return 0;
}
Won't compile because:
10 C:\Documents and Settings\zachary maynard\Desktop\assignment1.cpp invalid operands of types `double' and `int' to binary `operator%'
But it is the same if I use 1.0.
Why can't I use % with doubles?