当前位置:网站首页>int和位数组互转
int和位数组互转
2022-07-01 01:13:00 【友善啊,朋友】
int转位数组
#include <QDebug>
#include <bitset>
int main(int argc, char *argv[])
{
std::bitset<16> bits(1086);
bits[0] = 1;
for(std::size_t i = 0;i < bits.size();++i)
{
qDebug()<< bits[i];
}
}位数组转int
使用:QBitArray::toUInt32():
QBitArray bits(16);
bits.setBit(15);
bits.setBit(3);
bits.setBit(2);
bits.setBit(1);
qDebug()<<bits.toUInt32(QSysInfo::BigEndian);
qDebug()<<bits.toUInt32(QSysInfo::LittleEndian);
QByteArray array = bits.bits();
qDebug()<<QString(array.toHex());
边栏推荐
- AS400 大厂面试
- TypeError: Argument ‘angle‘ can not be treated as a double
- org.redisson.client.RedisResponseTimeoutException: Redis server response timeout (3000 ms)错误解决
- Laravel event & subscription
- Strictmode analysis activity leakage -strictmode principle (3)
- Try new possibilities
- Mathematical knowledge: finding combinatorial number III - finding combinatorial number
- [content of content type request header]
- 软件开发中的上游和下游
- 远程办公如何保持高效协同,实现项目稳定增长 |社区征文
猜你喜欢

Selenium经典面试题-多窗口切换解决方案

未来的 Web3会带来什么?

Necessary tools for testing - postman practical tutorial

那些一门心思研究自动化测试的人,后来怎样了?

软件测试的可持续发展,必须要学会敲代码?

45 year old programmer tells you: why do programmers want to change jobs? It's too true

Understanding and application of Qt5 layout in creation

Qt5 mvc: revealing the secrets of data visualization

For the sustainable development of software testing, we must learn to knock code?

Neo4j installation, operation, project construction and function realization
随机推荐
Using recyclerreview to show banner is very simple
迪赛智慧数——其他图表(平行坐标图):2021年应届专业就业情况
System. Csrebot for commandline
For the sustainable development of software testing, we must learn to knock code?
laravel 事件 & 监听
Matlab farthest point sampling (FPS improved version)
Thinking brought by strictmode -strictmode principle (5)
Laravel+redis generates an order number - automatically increase from 1 on the same day
After working for 6 years, let's take stock of the golden rule of the workplace where workers mix up
Handsontable數據網格組件
With regard to the white box test, you have to master these skills~
Opencv -- Notes
Mathematical knowledge: finding combinatorial number III - finding combinatorial number
Selenium经典面试题-多窗口切换解决方案
测试必备工具-Postman实战教程
Handsontable数据网格组件
Sort custom function
electron之坑addon
Analysis on user behavior loss of data exploration e-commerce platform
【多源bfs】934. Shortest Bridge