C++: Binary data type

Objectives :

  • Ascii to Binary conversion ( this page is being edited, pardon)
  • Calling Function: Calling a function  is often associated with calling other functions. A function terminates or ends when it encounters a closing brace or  "return" statement.
    • We can quit a function using exit() function in C programming
  • How to Quit main() using exit function of <stdlib.h> .
    • We can use return(0) or exit(0) signals for normal completion of the function.
    • Usually a non-zero, like return(1) or exit(1) signals for an error or failure to caller like main().
    • please also view this example: return_exit_functions1.htm
  • myBinary1
    for(n1=256; n1>0; n1 = n1/2)
    {
    if(ch1 & n1){ cout << "1"; }
    else { cout << "0"; }
    //cout << "";
    }
  • Code : myBinary1.txt

Quick Review about Binary Counting

Decimal Values

Binary Values

0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010
11 1011
12 1100
   

Step: 1 Create a project

Step: 2 Create a source file

Step: 3 Edit Source file ( To review the complete code, please use this link myBinary1.txt )

Step: 4 Runtime Views:

Similar views with Quincy compiler: myBinary2.htm

Step: 5 Problem with Eclipse 3.3 compiler in windows  xp professional, where the function "exit(1)" was not recognized

Below is the screenshot, showing that Eclipse Europa 3.3, GUI win MinGW, did respond to the function"exot(1)".