最終更新日時(UTC): 2025年07月11日 17時16分44秒
Koichi Murase が更新

履歴 編集

class
<cstdlib>

std::lldiv_t(C++11)

namespace std {
  struct lldiv_t {
    long long quot;
    long long rem;
  };
}

概要

std::div()関数のlong long版の戻り値

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

#include <iostream>
#include <cstdlib>

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

出力

2
1

Morty Proxy This is a proxified and sanitized view of the page, visit original site.