1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. char *entry, letter, choice[2];
  7. int ascii, len, binary[8], total;
  8. void bname();
  9.  
  10. int main()
  11. {
  12. bname();
  13. cout << endl;
  14. system("pause");
  15. }
  16.  
  17. void bname()
  18. {
  19. entry = new char[501];
  20.  
  21. cout << "Enter Name :";
  22. cin.getline(entry, 500);
  23.  
  24. len = strlen(entry);
  25.  
  26. for(int i = 0; i < len; i++)
  27. {
  28. total = 0;
  29.  
  30. letter = entry[i];
  31.  
  32. ascii = letter;
  33.  
  34. while(ascii > 0)
  35. {
  36. if((ascii%2)==0)
  37. {
  38. binary[total] = 0;
  39. ascii = ascii/2;
  40. total++;
  41. }
  42. else
  43. {
  44. binary[total] = 1;
  45. ascii = ascii/2;
  46. total++;
  47. }
  48. }
  49. total--;
  50. while(total >= 0)
  51. {
  52. cout << binary[total];
  53. total--;
  54. }
  55. }
  56. delete[] entry;
  57. }
  58.