当前位置:网站首页>1137: encrypted medical record
1137: encrypted medical record
2022-06-30 14:49:00 【I would, I think】
Method 1 :
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
char a[500];
char b[500];
char c[500];
cin.getline(a,500);
for(int i=0;i<strlen(a);i++)
{
if(a[i]=='x')
{
b[i]='a';
}
else if(a[i]=='y')
{
b[i]='b';
}
else if(a[i]=='z')
{
b[i]='c';
}
else if(a[i]=='X')
{
b[i]='A';
}
else if(a[i]=='Y')
{
b[i]='B';
}
else if(a[i]=='Z')
{
b[i]='C';
}
else
{
b[i]=a[i]+3;
}
}
for(int i=0;i<strlen(a);i++)
{
c[i]=b[strlen(a)-1-i];
}
for(int i=0;i<strlen(a);i++)
{
if(c[i]>=65&&c[i]<=90)
{
c[i]=c[i]+32;
}
else
{
c[i]=c[i]-32;
}
}
for(int i=0;i<strlen(a);i++)
{
cout<<c[i];
}
return 0;
}Method 2 : use switch...case
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
char a[500];
char b[500];
char c[500];
cin.getline(a,500);
for(int i=0;i<strlen(a);i++)
{
switch(a[i])
{
case 'x':
b[i]='a';
break;
case 'y':
b[i]='b';
break;
case 'z':
b[i]='c';
break;
case 'X':
b[i]='A';
break;
case 'Y':
b[i]='B';
break;
case 'Z':
b[i]='C';
break;
default:
b[i]=a[i]+3;
}
}
for(int i=0;i<strlen(a);i++)
{
c[i]=b[strlen(a)-1-i];
}
for(int i=0;i<strlen(a);i++)
{
if(c[i]>=65&&c[i]<=90)
{
c[i]=c[i]+32;
}
else
{
c[i]=c[i]-32;
}
}
for(int i=0;i<strlen(a);i++)
{
cout<<c[i];
}
return 0;
}Method 3 : Minimalist
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
char a[500];
char b[500];
char c[500];
cin.getline(a,500);
for(int i=0;i<strlen(a);i++)
{
if((a[i]>='x'&&a[i]<='z')||(a[i]>='X')&&a[i]<='Z')
{
b[i]=a[i]-23;//x,y,z Three elements move right 3 The situation of the first position
}
else
b[i]=a[i]+3;
}
for(int i=0;i<strlen(a);i++)
{
c[i]=b[strlen(a)-1-i];// The reverse : The first and the last are interchangeable ; The second and penultimate are interchanged
}
for(int i=0;i<strlen(a);i++)
{
if(c[i]>=65&&c[i]<=90)// Capital Add 32 Change to lowercase
{
c[i]=c[i]+32;
}
else// Lowercase letters
{
c[i]=c[i]-32;
}
}
for(int i=0;i<strlen(a);i++)
{
cout<<c[i];
}
return 0;
} 边栏推荐
- Machine learning feature selection
- Using docker to manage MySQL services under Windows
- Binary rotation array (1)
- jsPlumb. Deleteeveryconnection is not a function & jsplumb clear canvas jsplumb delete all nodes and all connections
- Uniapp upload image method
- How does hbuilder display in columns?
- 文本匹配——【NAACL 2022】GPL
- Laravel RBAC laravel permission use
- Att & CK red team evaluation field (I)
- JS to realize simple lottery function
猜你喜欢

DiceCTF - knock-knock

After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs

Solve the problem that codeblocks20.03 on win11 cannot run for the first time

How to use Alibaba Vector Icon

CCF date calculation (Full Score code + skill summary) February 2, 2015

Shangpinhui knowledge points of large e-commerce projects

CCF numerical sorting (Full Score code + problem solving ideas + skill summary) 201503-2

2021-07-14 mybaitsplus

Svn password forgetting solution

ThinkPHP show method parameter controllable command execution
随机推荐
Double pointer letter matching
Upgrade centos7 mysql5.5 to mysql5.7 non RPM in the form of tar package
Logiciel de récupération de données easyrecovery15 téléchargement
Error $(...) size is not a function
[extensive reading of papers] a delicious recipe analysis framework for exploring multi modal recipes with variable attributes
[extensive reading of papers] multimodal attribute extraction
XSS challenge (6-10) more detailed answers
Programming exercises: whole point and circle (solution ideas and code implementation)
Programming exercises: special numbers (problem solving ideas + code implementation)
Use of laravel repository mode
For loop and promise to solve the problem of concurrent callback
DR-TANet: Dynamic Receptive Temporal Attention Network for Street Scene Change Detection
IO interview questions
浅析卧式加工中心上不规则台阶孔存在问题
CCF window (Full Score code + problem solving idea) March 2, 2014
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
[untitled]
Add attributes to multimode
Lihongyi machine learning 2020 homework summary
CCF image rotation (Full Score code + problem solving idea) 201503-01