本文整理汇总了C++中calendar::get_today方法的典型用法代码示例。如果您正苦于以下问题:C++ calendar::get_today方法的具体用法?C++ calendar::get_today怎么用?C++ calendar::get_today使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calendar
的用法示例。
在下文中一共展示了calendar::get_today方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: c
void ribi::imcw::company::buy_click_card(
person& customer,
balance& account_euros,
bank& the_bank,
calendar& the_calendar
)
{
assert(customer.has_account(account_euros));
#ifndef NDEBUG
const auto before = account_euros.get_value();
#endif
the_bank.transfer(
account_euros,
money(click_card::cost_inc_vat_euros),
m_balance_undistributed,
the_calendar.get_today()
);
#ifndef NDEBUG
const auto after = account_euros.get_value();
assert(after < before);
#endif
//ClickCard will be valid the first day of the next month
click_card c(
the_calendar.get_today() //Purchase date
);
customer.add_click_card(c);
}
示例2:
void ribi::imcw::company::distribute_net_profit(
bank& the_bank,
calendar& the_calendar
) noexcept
{
const money profit = m_balance_undistributed.get_value();
const money to_compensation_plan = profit * proportion_of_profit_to_compensation_plan;
const money to_holding = profit * proportion_of_profit_to_holding;
const money to_reserves = profit * proportion_of_profit_to_reserves;
const money to_winners = profit * proportion_of_profit_to_winners;
the_bank.transfer(
m_balance_undistributed, //Sender
to_compensation_plan,
m_balance_compensation_plan, //Target
the_calendar.get_today()
);
the_bank.transfer(
m_balance_undistributed, //Sender
to_holding,
m_balance_holding, //Target
the_calendar.get_today()
);
the_bank.transfer(
m_balance_undistributed, //Sender
to_reserves,
m_balance_reserves, //Target
the_calendar.get_today()
);
//Shortly transfer it to the Winners balance...
the_bank.transfer(
m_balance_undistributed, //Sender
to_winners,
m_balance_winners, //Target
the_calendar.get_today()
);
//then distribute all over the customers
distribute_net_profit_winners(
m_balance_winners, //Sender
to_winners,
the_bank,
the_calendar
);
distribute_net_profit_compensation_plan(
m_balance_compensation_plan, //Sender
to_compensation_plan,
the_bank,
the_calendar
);
}
示例3: assert
void ribi::imcw::company::distribute_net_profit_winners(
balance& source,
const money& total_money,
bank& the_bank,
calendar& the_calendar
) noexcept
{
//Collect the Winners from all customers
std::vector<std::reference_wrapper<winner>> winners = collect_winners();
//Distribute the money over the winners
//const int n_winners{count_winners()};
const int n_winners{static_cast<int>(winners.size())};
if (n_winners == 0) {
//Transfer money to reserves
the_bank.transfer(
source,
total_money,
m_balance_reserves,
the_calendar.get_today()
);
return;
}
assert(n_winners > 0);
const money income_per_winners_euros
= total_money
/ static_cast<double>(n_winners)
;
for (std::reference_wrapper<winner>& w: winners)
{
#ifndef NDEBUG
const auto winner_value_before = w.get().get_value();
#endif
the_bank.transfer(
source,
income_per_winners_euros,
w.get().get_balance(),
the_calendar.get_today()
);
#ifndef NDEBUG
const auto winner_value_after = w.get().get_value();
assert(winner_value_after >= winner_value_before);
#endif
}
if (m_verbose) { std::clog << "Process the Winners" << std::endl; }
for (person& customer: m_customers)
{
customer.process_winners(
the_bank,
the_calendar,
*this
);
}
if (m_verbose)
{
std::clog
<< "Distributing " << total_money << " over the winners\n"
<< "n_winners: " << n_winners << '\n'
<< "income_per_winners_euros: " << income_per_winners_euros << " \n"
;
}
}