我有一個小問題。我創建了2D int數組。當我知道它時,我會得到十進制的十六進制數字。我正在使用Dev C++。十進制本身轉換爲十六進制
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
const int max=9;
int ar[max][max]={
{0,6,0,0,2,0,0,4,0},
{5,0,0,3,0,0,0,0,0},
{0,8,0,0,1,0,0,0,0},
{6,0,0,0,0,7,0,0,0},
{0,3,7,0,0,0,2,8,0},
{0,2,0,8,0,0,0,3,0},
{0,0,0,0,0,0,0,0,0},
{7,0,0,4,0,0,0,0,1},
{0,0,0,0,6,0,0,2,0}};
for (int i=0;i<max;i++){
for(int j=0;j<max;j++){
cout<<ar[i,j]<<" ";
}
cout<<"\n";
}
system("pause");
return 0;
}
作爲回報,我得到這個http://www.dropmocks.com/mf8wl
我很驚訝這個編譯。 – anio
@anio - 我得到一個警告http:// ideone。com/G5n4Z –
不要使用Dev C++:http://stackoverflow.com/tags/dev-c%2b%2b/info –