getting input from user(character) converting to binary

This is a discussion on getting input from user(character) converting to binary within the C Programming forums, part of the General Programming Boards category; how would i get a input from user (enter a character), enter 2nd character and convert them to binary then ...

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    4

    getting input from user(character) converting to binary

    how would i get a input from user (enter a character), enter 2nd character and convert them to binary then check the haming distance between them

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Someone asked this very question earlier. You should search for it.

  3. #3
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    977
    don't know what the heck a haming distance is, but I think the fact that char's are also their corresponding ASCII code might help you.

    char a = 'a';
    char a = 97; // same thing

    ...

    char b;
    scanf("%c",&b);
    // do whatever to b, b is a number from 0 to 255

  4. #4
    Registered User
    Join Date
    Sep 2009
    Posts
    4
    im trying to get a character from user (it can be a or b or a number).... then convert it to binary i can do the hamming i just cant figure out the way to get the input and convert it to the binary

  5. #5
    Registered User
    Join Date
    Sep 2009
    Posts
    4
    Quote Originally Posted by tabstop View Post
    Someone asked this very question earlier. You should search for it.
    couldnt able to find irt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help with C program writing
    By The_PC_Gamer in forum C Programming
    Replies: 9
    Last Post: 02-12-2008, 09:12 PM
  2. converting text to binary
    By nhallahan in forum C++ Programming
    Replies: 2
    Last Post: 02-14-2006, 04:55 PM
  3. Converting decimal to binary
    By ubernos in forum C Programming
    Replies: 3
    Last Post: 12-06-2005, 10:09 AM
  4. data input in binary format
    By aamirsyed in forum C Programming
    Replies: 1
    Last Post: 06-30-2004, 06:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21