The program task is to convert the genetic phonetic alphabet to 6 digits, we can use any well-remembered pinyin string, the transformation process is as follows, the first step, the string six a group of folding up, such as wangximing into:
Wangxi
Ming
In the second step, we want to add the ASCII value of all the characters perpendicular to the same position, and draw out 6 numbers, as the example above, then draw 228 202 206
Then the number of each digit processing, that is, the number of each bit is added, the figure if not a number, in the indentation, and finally into 344836
#include <stdio.h>#include<string.h>intCheckintN) { intsum=0; if(n<Ten)returnN//returns directly when N is a single digit while(n>0){//plus the numbers on each bit of N.sum+=n%Ten; N=n/Ten; } check (sum); //check and whether it is single digit, repeat the above operation}//Wangxi//MingvoidFChara[]) { intb[6]={0};//creates a new array that is stored in a character array and for(intI=0; I<strlen (a); i++) {B[i%6]+=a[i];//new array loop to add new characters } for(intI=0;i<6; i++) {printf ("%d", B[i]); } printf ("\ n"); for(intI=0;i<6; i++) {printf ("%d", check (B[i])); }}intMain () {Chara[]={"wangximing"}; f (a); return 0;}
Blue Bridge Cup cipher generator