| |

VerySource

 Forgot password?
 Register
Search
View: 1894|Reply: 18

Give me advice

[Copy link]

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-29 21:00:01
| Show all posts |Read mode
Let the program generate a 64-bit binary code. Divided into 5 parts

2 3 14 20 25 2 + 3 + 14 + 20 + 25 = 64

The first part is fixed, for example, it can be 00 or 01, 11 10, others are randomly generated, and then the generated code is sent to (interface?) So that others can read.



What should I think?


I have been learning C # for more than a month, and I am learning while doing it. This is simply too difficult. . . I hardly know it at all. . . Prawn Gate gave me a piece of similar code, or instructed my younger brother how to think, and then I was working, anyway, thank you!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-11 12:30:02
| Show all posts
do not understand
Reply

Use magic Report

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-5-11 23:30:01
| Show all posts
2 3 14 20 25 represents the codes of these 5 partitions,
such as
Header Filter Value Manufacturer Identification Code Trade Item Code Serial Code
 2 3 14th place 20th place 25th place
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-5-12 10:30:02
| Show all posts
If the first part is: 02
2 + 3 + 14 + 20 + 25 = 64
The sum of the five parts is equal to 64, the second part is equal to 64 minus the first part is a random part is the second part, the third part is equal to 64-second part-a random number after the first part, and so on.
However, it is possible that the latter part is 00.
Send to the serial port, you can use the serial port control
byte buff = new byte [4];
buff [0] = 02;
buff [1] = 03;
....
Write (buff, 0,4)
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 Brazil

Post time: 2020-5-12 16:15:01
| Show all posts
Random random out a number
Console.WriteLine (Convert.ToString (69, 8)); // Output 69 in octal
Then attach it
Reply

Use magic Report

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-5-12 18:00:01
| Show all posts
Upstairs, this is a 64-bit binary, so the beginning is only 00 01 10 11 four,

I was thinking, first get a decimal, and then convert to binary line?

Thank you for the serial control
Reply

Use magic Report

2

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-5-14 15:45:01
| Show all posts
// output 69 in octal

What means?
Reply

Use magic Report

0

Threads

22

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 United Arab Emirates

Post time: 2020-6-2 09:30:01
| Show all posts
I was thinking, first get a decimal, and then convert to binary line?

I think this method might be a try
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-6-3 13:45:02
| Show all posts
I don’t quite understand..

Do you mean that the first two bits are ok, just need to generate the next 62 bits, right?
Reply

Use magic Report

0

Threads

22

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-6-5 23:15:01
| Show all posts
The most stupid way

                           Random ran16=new Random();
string strTmp;
string str16 = "01";//Initialize fixed 2-bit data, such as 01
while(str16.Length <(64 + 4)) // Four spaces
{
strTmp = ran16.Next(0,15).ToString();
switch(strTmp)
{
case "10":
str16 += "A";
break;
case "11":
str16 += "B";
break;
case "12":
str16 += "C";
break;
case "13":
str16 += "D";
break;
case "14":
str16 += "E";
break;
case "15":
str16 += "F";
break;
default:
str16 += strTmp;
break;
}

switch(str16.Length)
{
case 6:
str16 += "";
break;
case 21:
str16 += "";
break;
case 42:
str16 += "";
break;
default:
break;
}
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list