Answers for "decimal to binary predefined function"

C++
1

decimal to binary predefined function

#include <iostream>
#include <stdlib.h>

int main ()
{
    int i;
    char buffer [33];
    printf ("Enter a number: ");
    scanf ("%d",&i);
    itoa (i,buffer,10);
    printf ("decimal: %s\n",buffer);
    itoa (i,buffer,16);
    printf ("hexadecimal: %s\n",buffer);
    itoa (i,buffer,2);
    printf ("binary: %s\n",buffer);
    return 0;
}
Posted by: Guest on April-23-2021
0

decimal to binary predefined function

std::string binary = std::bitset<8>(n).to_string();
Posted by: Guest on April-23-2021

Code answers related to "decimal to binary predefined function"

Browse Popular Code Answers by Language