How to BINARY CONVERTOR IN C++ ?

#include
using namespace std;
#include
#include

char *entry, letter, choice[2];
int ascii, len, binary[8], total;
void prog();

int main()
{
prog();
return 0;
}

void prog()
{
entry = new char[501];
/* entry should be dynamic, otherwise a new
string entry of 501 chars would be created
each time function is called!
Talk about memory hog! */
cout<<"Enter string to convert (up to 500 chars): "; cin.getline(entry, 500); len = strlen(entry); /* get the number of characters in entry. */ /* this loop is executed for each letter in the string. */ for(int i = 0; i0) /* This while loop converts the ASCII # into binary,
stores it backwards into the binary array. */
{
/* To get the binary code one must take the decimal number in
question, take it and divide it by two repeatedly, save
the remainder (which will become the binary number), save
the whole number, divide by two, and repeat the whole
process until 0 is reached. This if-else statement serves
this functionality, by getting the remainder of the ascii
code, storing it in the array and then dividing the int
ascii by two */
if((ascii%2)==0)
{
binary[total] = 0;
ascii = ascii/2;
total++; /* increasing by one each time will yeild the
number of numbers in the array. */
}
else
{
binary[total] = 1;
ascii = ascii/2;
total++;
}
}
total--; /* due to data type factors, the program will actually
add a 0 at the end of the array that is not supposed
to be there, decrementing total will solve this
problem, as that 0 will not be displayed. */
/* this while loop displays the binary code for that letter. */
while(total>=0)
{
cout<
total--;
}
}
delete[] entry; /* free up the memory used by entry */
cout<<<"Do again(1 = yes, 2= no)?: "; cin.getline(choice,3); if(choice[0] == '1') prog(); /* program is recursive, it calls itself. It's kinda like a function loop of sorts. */ else exit(0); /* quits the program */ } source: www.cplusplus.com

HOW TO SELECT A LANGUAGE FOR CODING AN APPLICATION

One is often faced with the situation of selecting a programming language, out of the many options available for coding an application. The following factors generally influence the selection process:

  • Nature of the application: The language should be suitable for the application area. For example, FORTRAN is suitable for scientific and engineering applications, while COBOL is suitable for business applications.
  • Familiarity with the language: If there are multiple languages, which are found suitable for the application area, the language selected should be one that is best known to the programmers who are going to code the application.
  • Easy of learning the language: If there are multiple languages, which are found suitable for the application area, and if the programmers are not familiar with any of them, the language, which is easier to learn and use, should be selected.
  • Availability of programme development tools: Before selecting a language, one must also find out whether the language is well supported wtih good programme development tools like compiler, interpreter, debugger, linker etc. The time and effort needed for coding the application can be greatly reduced, if the selected language is supported with good programme development tools.
  • Names, how to designe the GUI for the software, how and up to what detail to include comments in programme code, and what diagrams, charts, reports, outputs, etc. Necessary for documentation to be complete successully.
Souce: Computer Fundaments (III Edition)