ch1-Modulus (for integers)

Chapter_1     Hex Truncate







Modulus.cpp


#include <iostream>
using std::cout;
using std::endl;

int main()
{
  float x = 5, y = 3;
 
  // cout << "x % y = " << x % y << endl; // compile error
  cout << "x % y = " << (int)x % (int)y << endl;
 
  return 0;
}
/*
g++ Modulus.cpp -o Modulus
./Modulus
x % y = 2
*/









Chapter_1     Hex BACK_TO_TOP Truncate



Comments

Popular posts from this blog

Contents