In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how C++ to achieve two-dimensional array spiral encryption information, I hope you will learn something after reading this article, let's discuss it together!
According to the requirements of the topic, it is necessary to create a matrix of r rows and c columns.
Then enter a string that must be less than the length of the r*c/5
From the representation of A C M, we can see that each character is represented by a 5-bit binary bit system (unsigned bits)
So we can first create a string type.
String adriamycin > > a
The letter rt indicates the letter of the 26 alphabet.
Many people want to use array 11 correspondence or switch statement to choose
But when I think about it, I know it's too troublesome, so here I use the ASCII code of the character minus 64 to represent its digital form.
Strong type conversion is known to ASCII codes.
Because there is more than one character, in order to improve the reusability of the code, we write a function to return binary values in the numeric form of letters.
Int bit (char a) / / defines a function that converts letters to binary numbers and returns binary numbers {int num=int (a)-64; int result = 0, j = 1; while (num) {result = result + j * (num% 2); num= num / 2; j = j * 10;} return result;}
If you have a binary value, you have to make sure that each letter can be converted to a 5-bit binary system.
So it's best to put a loop in a loop, such as 00011, which has no data type, and put it directly into an array, so let's define an array first.
Then follow the process to put 1 and 0 in and complete the 0 through the while loop
For (int count0=0;count0=jStart) {/ / the above line for (times1++; iEnd -) {array [iEnd] [j] = arr [times1]; times1++;} iEnd-- } / / the left column if (jEnd > = jStart) {for (itimesi > = iStart;i--) {array [I] [jStart] = arr [times1]; times1++;} jStart++ }}
According to the meaning of the question, there is also a big pit, which the disgusting author asked us to print normally, that is, the first line, the second line and the third line.
It's full of holes everywhere.
So directly a nested for loop
For (iSuppli)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.