Hey all, my names joe and im running into a few issues with the modulus in c++
heres the problem:
#include <iostream>
#include <string>
using namespace std;
int main()
{
//In short, this is what i am trying to do:
//divide two numbers, and get both the quotient
//and the remainder
//however, as an example, this below produces a remainder
//of 10
//110 \ 20 should equal 5 remainder 5
int firstInput =110, secondInput = 20;
int quotient = 0, remainder = 0;
quotient = firstInput / secondInput;
remainder = firstInput % secondInput;// i think the problem is here
cout << "The quotient is " << quotient << " and the remainder is "
<< remainder << endl;
system("pause");
return 0;
}
basically its not computing the remainder correctly. any help of course would be much appreciated. cheers