vendredi 30 juillet 2021

How do i store a binary number in an array?

Ok, so i been working on this right here that is intended to be part of a encryption software that works synonymously like 2fa

 #include <iostream>
 #include <cstdio>     
 #include <cstdlib>   
 #include <ctime>    
 using namespace std;

 int main()
 {


int RGX;
int box[32];

srand (time(NULL));


RGX = rand() % 100000000 + 9999999;

cout << "Random Generated One Time HEX #:" << endl;

cout << std::hex << RGX << endl;


while(RGX!=1 || 0)
{

int m = RGX % 2;
cout << " " << m << " ";


RGX = RGX / 2;


cout << RGX << endl;



} 

return 0;
}

Here is a sample of what it outputs:

Random Generated One Time HEX #:
3ff3c70
0 1ff9e38
0 ffcf1c
0 7fe78e
0 3ff3c7
1 1ff9e3
1 ffcf1
1 7fe78
0 3ff3c
0 1ff9e
0 ffcf
1 7fe7
1 3ff3
1 1ff9
1 ffc
0 7fe
0 3ff
1 1ff
1 ff
1 7f
1 3f
1 1f
1 f
1 7
1 3
1 1


** Process exited - Return Code: 0 **

The result is different each time since it's randomized, i'm still not finished. But what i need to know is how do i store the binary value in an array, the binary value are the numbers on the left.




Aucun commentaire:

Enregistrer un commentaire