Text-to-Binary :P menu

User Tag List

Results 1 to 3 of 3
  1. #1
    Le Froid's Avatar Contributor
    Reputation
    172
    Join Date
    Mar 2007
    Posts
    1,327
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text-to-Binary :P

    This is a simple text-to-binary thing written in C++ that I thought I'd share since it is useless

    10001011010011101110110000111100101111001100000101010011101001101111111100101101 0011100001110111001

    Code:
    #include <iostream>
    using namespace std;
    #include <cstring>
    #include <cstdlib>
    
    char *entry, letter, choice[2];
    int ascii, len, binary[8], total;
    void prog();
    
    int main()
    {
          prog();     
          return 0;
    }        
            
    void prog()
    {
       entry = new char[501]; 
       cout<<"Enter string to convert to binary stuff (up to 500 chars): ";
       cin.getline(entry, 500);
       len = strlen(entry); 
       for(int i = 0; i<len; i++)
       {
          total = 0;
          letter = entry[i];
          ascii = letter;    
          while(ascii>0) 
          {
             
             if((ascii&#37;2)==0)
             {
                binary[total] = 0;
                ascii = ascii/2;
                total++;
             }
             else
             {
                binary[total] = 1;
                ascii = ascii/2;
                total++;
             }
          }
          total--;
          while(total>=0)
          {
             cout<<binary[total];
             total--;
          }
       }
       delete[] entry;
       cout<<endl<<"Do it again?(1 = yes, 2= no)?: ";
       cin.getline(choice,3);
       if(choice[0] == '1')
          prog(); 
       else
          exit(0); 
    }
    Save as a ____.cpp file and then compile.

    Credits-www.cplusplus.com made most of the code, i edited it around.

    Text-to-Binary :P
  2. #2
    aflacattack's Avatar Member
    Reputation
    34
    Join Date
    Jun 2007
    Posts
    240
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yay? and your avatar creeps me out

  3. #3
    Phase228's Avatar Member
    Reputation
    352
    Join Date
    Jan 2007
    Posts
    1,502
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i can now insult people with numbers....
    My Life Is Complete
    Hey Piggy



Similar Threads

  1. Mancow/Joana 1-60 Leveling Guide (Text Only)
    By Gothian in forum World of Warcraft Guides
    Replies: 12
    Last Post: 12-05-2006, 06:36 PM
  2. Joana's text guide!!
    By thekillerwhale in forum World of Warcraft Guides
    Replies: 3
    Last Post: 11-16-2006, 06:23 AM
  3. Haunted 1-45ish Leveling Guide(Text)
    By x_jonnyb.good_x in forum World of Warcraft Guides
    Replies: 0
    Last Post: 10-04-2006, 07:53 PM
  4. Joanna/mancow text guide. No download required.
    By Sasuke in forum World of Warcraft Guides
    Replies: 1
    Last Post: 07-15-2006, 02:36 PM
All times are GMT -5. The time now is 04:43 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search