Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
using namespace std; #define MAX 50 int countDigit(long long n){ return floor(log10(n)+1); } char* hexToDec(char hex[]){ int r, total=0; int length = strlen(hex); for(int i=0;i
='0' && hex[i] <='9'){ r = hex[i] - 48; }else if(hex[i]>='a' && hex[i]<='f'){ r = hex[i] - 87; }else if(hex[i]>='A' && hex[i]<='F'){ r = hex[i] - 55; } total += r*pow(16, length); } int l = countDigit(total); char *result = new char[l]; for(int i=0;i
=0;i--){ cout << num[i]; } cout << endl; } int main(){ char num[MAX]; cout << "Enter a hexadecimal number : "; while(cin >> num){ char* res = hexToDec(num); print(res); free(res); cout << "Enter a hexadecimal number : "; } return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)