Converting strings to binary reload algorithms

xiaoxiao2021-03-05  23

#include

Using namespace std;

String str2bin (char * STR)

{

INT Change, K = 0, MASK = 8;

Char bit;

Char stack [100] = {0};

For (Short I = 0; I

{

For (int J = 0; j <4; j )

{

Stack [K ] = (Mask & (STR [i] -48)? 49:48;

Mask >> = 1;

}

Mask = 8;

}

Return (Stack);

}

Int main (int Argc, char * argv [])

{

Char STR [8] = "0123456";

Cout << "You entered:" << Str << Endl;

COUT << "After the conversion is:" << str2bin (str) << endl;

System ("pause");

Return 0;

}

转载请注明原文地址:https://www.9cbs.com/read-35682.html

New Post(0)