当前位置:网站首页>1171: encryption (pointer topic)
1171: encryption (pointer topic)
2022-04-21 09:10:00 【Qian Qian】
1171: encryption ( Pointer theme )
Title Description
Encrypt a piece of plaintext . The encryption rules are as follows : Put each character of ascii Subtract from the value of the code 24 As the encrypted value of each character , for example ’a’ Of ascii The value of the code is 97, Then encryption becomes 73.“73" Namely ’a’ The ciphertext of , for example , character string "abc”, After encryption, it becomes "737475", Last , The whole ciphertext will be flipped again , Get the final ciphertext "574737". Now please write the program , Encrypt a piece of text . Please define and use the following functions :
void encrypt(char *plain, char *cipher)
{
// Put the original string plain After encryption, store the string cipher
}
Input
Enter a string , Contains only numbers and letters , The longest is 200.
Output
Output encrypted string .
The sample input Copy
zero12
Sample output Copy
625278097789
Tips
Of course, outputting ciphertext directly is the simplest way , But this question requires you to store the ciphertext in a string ( For use by other modules of the program ).
source / classification
#include<stdio.h>
#include<string.h>
#define N 202
/* Numeric and alphabetic ASCII code -24 After all 2 digit */
void encrypt(char *plain,char *cipher){
int j=0,len;
len=strlen(plain);
for(int i=len-1;i>=0;i--){
cipher[j++]=(int)(plain[i]-24)%10+'0';
cipher[j++]=(int)(plain[i]-24)/10+'0';
}
cipher[j]='\0';
}
int main(){
char *p,*q;
p=(char *)malloc(sizeof(char)*N);
q=(char *)malloc(sizeof(char)*(2*N));
gets(p);
encrypt(p,q);
puts(q);
return 0;
}
版权声明
本文为[Qian Qian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210906131592.html
边栏推荐
- [CTF. Show. Reverse] reverse AK race easydse
- Open3d reads and writes PCD point cloud files
- SurfaceView高性能绘制(四)代码实践篇-绘制多张图片
- Major programming languages and applications in 2022
- Implementation of pure student information linked list system in C Have you learned
- 2022 Shandong Province safety officer C certificate examination questions and simulation examination
- CC00026. CloudJenkins—————————————
- CC00000. CloudJenkins—————————————
- 1147: 查找子数组
- 1148: 组合三位数之一
猜你喜欢

Intranet penetration - proxy penetration - rights lifting - injection - MSF Middleware - domain penetration - log clearing - learning resources

Based on ASP Net online flower shopping management

Geek challenge 2019 upload 1

Selection of WiFi module for data transmission through industrial control serial port of intelligent gateway of Internet of things

Simulated 100 questions and simulated examination of Shanghai safety officer C certificate examination in 2022
![BUUCTF[HCTF 2018]WarmUp](/img/89/5d7d147dfb8e2bc10a2ff0bb68debe.png)
BUUCTF[HCTF 2018]WarmUp

Penetration test - get the system fofa keyword to brush the hole

PyS1:概述

Pipy mqtt agent (III) logging

Pyinstaller package exe (detailed tutorial)
随机推荐
BUUCTF[极客大挑战 2019]Havefun
1147: 查找子数组
CC00019. CloudJenkins—————————————
Meizu, once expected to challenge apple, now lives by providing accessories for Apple users
My blog navigation directory (constantly sorting and updating...)
Performance analysis ideas
Flink's API introduction case
CC00043. CloudJenkins—————————————
CC00026.CloudJenkins—————————————
CC00000. CloudJenkins—————————————
某系统拥有N个进程,总共7个资源,每个进程需要3个资源,问N数量最多为多少不会死锁?(附解析)
In 2017, I also started to write CSDN blog (Sina Netease moved to CSDN)
Major programming languages and applications in 2022
目标检测入门常见问题(深度学习 / 图像分类)
CC00000.CloudJenkins—————————————
postman测试Excel文件导入导出功能
Pyinstaller package exe (detailed tutorial)
PageRank case Airport
二叉树知识
Opencv -- separate color channel, image contrast, brightness adjustment, discrete Fourier transform (10)