Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How i can conver English Text in to Binary Language ic C or C++ programming?

If i am inputing "Hello" and if i want to convert that word in to Binary than is there any methematical process which support either C or C++ programming language.

If you know than please tell me and try to help me.

Please tell me the whole procedure to convert Text to Binary in C or C++ programming.

I am waiting for the good and well explained answer.

Thanks.

5 Answers

Relevance
  • Anonymous
    2 decades ago
    Favorite Answer

    I understand you want to convert A,B,C... to {0,1}, right? then. In C, all strings are character arrays, otherwise collection of characters. by converting each character u can do. as u can see each character both printable and other have a numerical value. it is in a table, ASCII table. Here the code

    ----------

    void binary(char ch)

    { if(ch>0) binary(ch/2);

    printf("%d",ch%2);

    }

    void toBinary(char*text)

    { for(i=0;text[i]!='\0';i++)

    { binary(test[i]);

    printf("\n");

    }

    }

    ----------

    i hope these two functions helps you.....

    good luck.

  • 2 decades ago

    Binary is 1's and 0's. English is a language. Text to a computer is also known as a character set. For you to convert a character a into its binary you need to understand the conversion table. The character set that you are probably interested in is ASCII. which consists of both printable and non printable characters.

    Almost every programming language can convert between ASCII and hex, or ASCII and binary.

  • Anonymous
    2 decades ago

    It has been a while that I have written any C programs so please read my reply with caution ! I am replying just because I was so fond of this language during my college days ;-)

    The answer give by person before me is right if you really wanted to have binary representation of english characters;

    If you meant ASCII representation(a=32,A=65 etc.) then here is how you can achieve it.

    In C there are plenty of ways you can achieve it

    1)

    Characters can be printed as numbers by using format specifiers

    printf("%d%d%d%d%d",'h','e','l','l','o');

    2)

    char c='h';

    int a=c;

    a will have the ASCII number for character in question

  • 2 decades ago

    I don't know about C or C++, but I know of a good text to binary and binary to text converter...

  • How do you think about the answers? You can sign in to vote the answer.
  • ?
    Lv 4
    5 years ago

    > PHP, ASP, Perl and etc is Server Side Programming language This is wrong. Languages are a means of expressing computation, how they are implemented is irrelevant to the language itself. Saying that a language is "server side" is just as silly as saying that it's "compiled". You can write a compiler for C, C++, and Java, and you can also write interpreters for them. Similarly, you can use Perl for writing/configuring network server programs just as you can use it for writing/configuring network client programs. edit: @Derp: C has no object oriented features, although all three have an imperative/procedural and structured nature. edit#2: You could write a web server from scratch using C, C++, Java, Perl, or another language. Or you could download Apache and use one of their extension languages (such as PHP and Perl). Or you could just build the functionality that you want, natively, into Apache using C by modifying its source code and recompiling it. When it comes down to it, it really just depends on what language your web server has support for. PHP was designed specifically for server-side programming, so it's really not efficient for doing anything other than that (but theoretically, it could be used for just about anything). Perl, on the other hand, is used for heaps of different programs, including both client and server programs. In any case, the term "server side programming language" attaches a particular use to language whose purpose is, very generally, just to express a computation. The point is that it's not a property of the language but rather, an implementation of the language.

Still have questions? Get your answers by asking now.