Нужна прога на с++ в общем нужен калькулятор с возможностью считать в различных системах счисления.
235
306
Ответы на вопрос:
//microsoft (r) c/c++ optimizing compiler version 19.00.23506 for x64 #include < iostream> #include < bitset> #include < sstream> const size_t hex(const std: : string& number) { size_t u_num = 0u; std: : istringstream ost(number); ost > > std: : hex > > u_num; return u_num; } template < typename l, typename r> const size_t& calculate(const l& l, const r& r) { return std: : bitset< 16> (l).to_ulong() + std: : bitset< 16> (r).to_ulong(); } int main() { std: : cout < < calculate(hex("7c"), 5) < < std: : endl; std: : cout < < calculate("11", hex("1d")) < < std: : endl; }
Популярно: Информатика
-
Vasianeumaha20.10.2022 07:04
-
DanilTasher10.12.2020 09:24
-
kassssseta01.10.2020 14:14
-
натусик25218.08.2020 22:04
-
ясмина11502.02.2021 00:37
-
Карина220322.04.2022 12:34
-
Синтол21.06.2020 21:12
-
Anastasya15626.01.2020 03:39
-
barashinaa8826.05.2020 18:44
-
sirushdarbinyap0aqdv18.11.2020 15:03