当前位置:网站首页>Exercise 8-8 moving letters
Exercise 8-8 moving letters
2022-07-03 14:09:00 【ᯤ⁹ᴳ⁺ ·】
practice 8-8 Moving letters (10 branch )
This problem requires writing functions , The first... Of the input string 3 Move characters to the last .
Function interface definition :
void Shift( char s[] );
among char s[]
Is the string passed in by the user , Ensure that the length of the title is not less than 3; function Shift
The string transformed as required must still exist s[]
in .
Sample referee test procedure :
#include <stdio.h>
#include <string.h>
#define MAXS 10
void Shift( char s[] );
void GetString( char s[] ); /* Implementation details are not shown here */
int main()
{
char s[MAXS];
GetString(s);
Shift(s);
printf("%s\n", s);
return 0;
}
/* Your code will be embedded here */
sample input :
abcdef
sample output :
defabc
void Shift( char s[] ){
char a[3];
int j,i;
for(i=0;i<3;i++){
a[i]=s[i];
}
for(i=3;s[i];i++){
s[i-3]=s[i];
}
for(j=i-3,i=0;i<3;i++){
s[j++]=a[i];
}
}
边栏推荐
- [Jilin University] information sharing of postgraduate entrance examination and re examination
- Qt学习23 布局管理器(二)
- Exercise 8-7 string sorting
- 战略、战术(和 OKR)
- 虽然不一定最优秀,但一定是最努力的!
- TS code automatically generates JS
- Canvas utility library fabric JS user manual
- Common network state detection and analysis tools
- [acnoi2022] guess numbers
- JVM class loading
猜你喜欢
Page generation QR code
Redis: commandes d'action pour les données de type chaîne
使用vscode查看Hex或UTF-8编码
Use vscode to view hex or UTF-8 codes
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
Redis: operation command of string type data
Conversion function and explicit
JS input number and standard digit number are compared. The problem of adding 0 to 0
GoLand 2021.2 configure go (go1.17.6)
随机推荐
UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取
js . Find the first palindrome string in the array
JS new challenges
Qt学习18 登录对话框实例分析
jvm-对象生命周期
GoLand 2021.1.1: configure the multi line display of the tab of the open file
Conversion function and explicit
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
Why don't I have a rookie medal
Exercise 8-7 string sorting
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
Use vscode to view hex or UTF-8 codes
Uniapp skills - dom display and hiding
Too many files with unapproved license
QT learning 17 dialog box and its types
从零开始的基于百度大脑EasyData的多人协同数据标注
Solve the problem of dormitory router campus network sharing login
Dynamic programming 01 knapsack and complete knapsack
JVM runtime data area