实例 C++ 模等于运算符

x
 
#include <iostream>
using namespace std;
int main() {
  int x = 5;
  x %= 3;
  cout << x;
  return 0;
}
                    

输出结果

2