C++ Int to Array without Libs
C++ Int to Array without Libs
大家早上好!我如何将int a = 325;
转换为数组int b[2]
,没有lib?我指的是b[0] = 3;
b[1] = 2;
b[2] = 5;
再见
执行如下操作:
int x = a;
int i = 0;
while (x > 0)
{
b[i++] = x % 10;
x /= 10;
}
你可以这样做
int i=100;
for(int x=0;x<3;x++)
{
b[x]=a/i;
a=a%i;
i=i/10;
}
相关文章:
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- dynamic_cast without RTTI
- Qt - QQuickWidget setSource without freezing UI
- "in-situ without memory allocation" 字符串的愚蠢实现意味着什么?
- C++线程"Call to non-static member function without an object argument"
- 添加qt-libs后出现编译错误
- 为简单的src,include,libs文件夹项目编写Makefile
- "How to make a recursive call for palindrom numbers without reverse function in c++?"
- Android Native libs - 如何对日志进行写入序列化
- 如何使用 std::transform with container without push_back.
- 安装 gRPC : ld: 警告: 找不到选项 '-L/<path>/grpc/libs/opt/c-ares' 的目录
- 将第三方Libs添加到我的CMAKE项目中
- 将c libaries转换为c libs
- Poco::Net::HTTPClientSession throw exception without unique_
- 使用CMAKE与Visual Studio BuildTools 2017;无法访问UWP libs
- C++线程未加入"Termination called without active exception"
- 如何理解pthread_cancel导致"terminate called without an active exception"?
- Android Studio without Java
- 创建C .lib项目,消费者项目必须引用LIBS所包含的
- C++ Int to Array without Libs