最終更新日時(UTC):
が更新

履歴 編集

class
<cstdlib>

std::div_t

namespace std {
  struct div_t {
    int quot;
    int rem;
  };
}

概要

std::div()関数の戻り値。

quotは「quotient (商)」、remは「remainder (剰余)」。

#include <iostream>
#include <cstdlib>

int main()
{
  std::div_t x = std::div(5, 2);
  std::cout << x.quot << std::endl;
  std::cout << x.rem << std::endl;
}

出力

2
1