当前位置:网站首页>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];
}
}
边栏推荐
- Why are grass-roots colleges and universities with "soil and poverty" called "Northeast small Tsinghua"?
- allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取
- JS input number and standard digit number are compared. The problem of adding 0 to 0
- jvm-对象生命周期
- Common network state detection and analysis tools
- 八大排序
- 解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)
- Scroll detection, so that the content in the lower right corner is not displayed at the top of the page, but is displayed as the mouse slides
- Exercise 9-1 time conversion
- Why don't I have a rookie medal
猜你喜欢
Current situation, analysis and prediction of information and innovation industry
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
JS Part 2
FPGA test method takes mentor tool as an example
jvm-类加载
Qt学习23 布局管理器(二)
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
八大排序
Interface for querying IP home
Programmable logic device software testing
随机推荐
Comprehensive case of MySQL data addition, deletion, modification and query
JS matrix zero
JS download files through URL links
Collection of mobile adaptation related articles
Redis:字符串类型数据的操作命令
Qt学习19 Qt 中的标准对话框(上)
Exercise 9-1 time conversion
“又土又穷”的草根高校,凭什么被称为“东北小清华”?
从零开始的基于百度大脑EasyData的多人协同数据标注
JS shift operators (< <,> > and > > >)
JS Part III
Redis: commandes d'action pour les données de type chaîne
Qt学习23 布局管理器(二)
[combinatorics] permutation and combination (two counting principles, examples of set permutation | examples of set permutation and circle permutation)
Common mixins
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
jvm-对象生命周期
Canvas utility library fabric JS user manual
Selenium browser (1)
好看、好用、强大的手写笔记软件综合评测:Notability、GoodNotes、MarginNote、随手写、Notes Writers、CollaNote、CollaNote、Prodrafts、Noteshelf、FlowUs、OneNote、苹果备忘录