std::bitset
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
std::bitset<N> është një varg me N bit-e që mund t'i ndezësh, fikësh dhe numërosh lehtë — p.sh. .count() tregon sa janë 1. Shfaqet edhe si numër binar me cout. I dobishëm në gara dhe për flamuj.
EnglishEN
std::bitset<N> is an array of N bits you can easily set, clear and count — e.g. .count() tells you how many are 1. It also prints as a binary number with cout. Useful in contests and for flags.
Si ta mendosh
Si një rresht me N llamba: i sheh menjëherë cilat janë ndezur.
Lexoje në anglisht
Like a row of N light bulbs: you see straight away which ones are on.
Shembull kodicpp
#include <bitset>
std::bitset<8> b(13);
std::cout << b; // 00001101
std::cout << b.count(); // 3