20140604 word表格中打钩 循环右移
2024-09-02 00:29:53
1、如在在word表格中打钩
符号->其他符号->字体(wingdings2)
2、循环右移
方法1:
#include<stdio.h>
void move(char *s) //循环右移1位
{
if(s==NULL)
return;
char *p=s,*q=s;
char temp;
while(*p!='\0')
{
p++;
}
p--;
q=p-;
temp=*p;
while(p!=s)
{
*p=*q;
q--;
p--;
}
*s=temp;
}
void LoopMove( char *pStr,int steps)//循环右移steps位
{
int i=;
while(i<steps)
{
move(pStr);
i++;
}
}
void main()
{
char str[]="abcdef";
//char *str="abcdef"; 这里“abcdef”是常量,不能通过str指针修改常量值,这种写法错误
LoopMove(str,);
printf("%s",str);
}
方法2:strcpy不能人为控制拷贝的字节数,只是以‘\0’来
#include<stdio.h>
#include<string.h>
#include<malloc.h>
void LoopMove(char *pStr,int steps)
{
int len=strlen(pStr);
int n=len-steps;
char *temp=(char *)malloc(sizeof(char *));
strcpy(temp,pStr+n);
strcpy(temp+steps,pStr);
*(temp+len)='\0';
strcpy(pStr,temp);
} void main()
{
char str[]="abcdef";
LoopMove(str,);
printf("%s",str);
}
方法3:memcpy可以控制复制的字节数
#include<stdio.h>
#include<string.h>
#include<malloc.h>
void LoopMove(char *pStr,int steps)
{
int len=strlen(pStr);
int n=len-steps;
char *temp=(char *)malloc(sizeof(char *));
memcpy(temp,pStr+n,steps);//
memcpy(pStr+steps,pStr+steps,n);
memcpy(pStr,temp,steps);
} void main()
{
char str[]="abcdef";
LoopMove(str,);
printf("%s",str);
}
最新文章
- 从头开始构建LINUX[内核更新和资料]
- windows programming can&#39;t find windows.h
- linux下解压war文件命令
- ubuntu系统下的防火墙使用
- Rectangle(csu)
- noip赛前小结3
- Java虚拟机类加载机制——案例分析
- ubuntu双网卡bonding配置(转)
- Shell常用操作
- 取A表数据,关联B表任意一条数据
- 在UC浏览器上很炫的一个效果
- 【流量】netflow 基础知识
- 统一addEventListener与attachEvent中this指向问题
- UNIX环境高级编程——文件I/O
- UEFI Shell命令操作总结
- mongoDB3.4的sharding集群搭建及JavaAPI的简易使用
- 最简单的网络图片的爬取 --Pyhon网络爬虫与信息获取
- awk中使用shell的环境变量
- Java读取文件加锁代码Demo(利用Java的NIO)
- 单页面应用SPA和多页面应用MPA