URL : https://codeup.kr/problemsetsol.php?psid=23
// 16진수 입력받아 8진수로 출력
// 8 10 16 = oct dec hex
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> hex >> n;
cout << oct << n;
return 0;
}
URL : https://codeup.kr/problemsetsol.php?psid=23
// 8진수 입력받아 10진수로 출력
#include <iostream>
using namespace std;
int octToDec(int n);
int main()
{
int n;
cin >> n;
cout << octToDec(n);
return 0;
}
int octToDec(int n)
{
int result = 0;
char cTemp[256];
_itoa(n, cTemp, 10);
for (int i = (strlen(cTemp) - 1); i >= 0; i--)
result += (cTemp[(i - 2) * -1] - 48) * pow(8, i);
return result;
}
URL : https://codeup.kr/problemsetsol.php?psid=23
// 입력받은 10진수를 16진수로 출력(2)
// input : 255
// output : FF
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
cout << uppercase << hex << n;
return 0;
}
URL : https://codeup.kr/problemsetsol.php?psid=23
// 입력받은 10진수를 16진수로 출력(1)
// input : 255
// output : ff
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
cout << hex << n;
return 0;
}
URL : https://codeup.kr/problemsetsol.php?psid=23
// 입력받은 10진수를 8진수로 출력
// oct = 8, dec = 10, hex = 16
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
cout << oct << n;
return 0;
}
URL : https://codeup.kr/problemsetsol.php?psid=23
#include <iostream>
using namespace std;
int main()
{
long long ll;
cin >> ll;
cout << ll;
return 0;
}