60 lines
983 B
C++
60 lines
983 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int i,k,n,m;
|
|
|
|
cout << "Podaj liczbe dziesietna: ";
|
|
cin >> n;
|
|
int *a = new int[n];
|
|
|
|
m=n;
|
|
|
|
i = 1;
|
|
while(m>=1) {
|
|
a[i] = m % 16;
|
|
m = m / 16;
|
|
i++;
|
|
}
|
|
|
|
k = i - 1;
|
|
|
|
cout << endl;
|
|
|
|
for(i = 1; i <= k; i++) {
|
|
if(i % 4 == 0) {
|
|
cout << " ";
|
|
}
|
|
if(a[i] > 9) {
|
|
if(a[i] == 10) {
|
|
cout << "A";
|
|
}
|
|
if(a[i] == 11) {
|
|
cout << "B";
|
|
}
|
|
if(a[i] == 12) {
|
|
cout << "C";
|
|
}
|
|
if(a[i] == 13) {
|
|
cout << "D";
|
|
}
|
|
if(a[i] == 14) {
|
|
cout << "E";
|
|
}
|
|
if(a[i] == 15) {
|
|
cout << "F";
|
|
}
|
|
}
|
|
else {
|
|
cout << a[i];
|
|
}
|
|
|
|
}
|
|
|
|
cout << endl;
|
|
|
|
delete [] a;
|
|
|
|
system("pause");
|
|
return 0;
|
|
} |