c++10进制转换为16进制题// Note:Your choice is C++ IDE#include using namespace std;int main(){int i,j,n=0;char k[20];char s[17]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};couti;while(i!=0){j=i%16;k[n]=s[j+1];j=j/16;n++;}
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 13:18:27
c++10进制转换为16进制题// Note:Your choice is C++ IDE#include using namespace std;int main(){int i,j,n=0;char k[20];char s[17]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};couti;while(i!=0){j=i%16;k[n]=s[j+1];j=j/16;n++;}
c++10进制转换为16进制题
// Note:Your choice is C++ IDE
#include
using namespace std;
int main()
{
int i,j,n=0;
char k[20];
char s[17]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
couti;
while(i!=0)
{
j=i%16;
k[n]=s[j+1];
j=j/16;
n++;
}
cout
c++10进制转换为16进制题// Note:Your choice is C++ IDE#include using namespace std;int main(){int i,j,n=0;char k[20];char s[17]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};couti;while(i!=0){j=i%16;k[n]=s[j+1];j=j/16;n++;}
修改如下:
#include
using namespace std;
int main()
{
int i,j,n=0;
char k[20];
char s[17]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
couti;
while(i!=0)
{
j=i%16;
k[n]=s[j];//////////////////注意这里
i/=16;//////////////////注意这里
n++;
}
cout