1 Star 0 Fork 0

范敬文/cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
指向指针的指针处理字符串.cpp 641 Bytes
一键复制 编辑 原始数据 按行查看 历史
范敬文 提交于 2020-10-24 21:21 +08:00 . master
#include<iostream>
using namespace std;
int main(){
void sort(char **p);
int m;
char **p,*pstr[5],str[5][m];//若是整数则对一维数组取地址然后再由二维指针指向
m=20;
for(int i=0;i<5;i++)pstr[i]=str[i];
for(int i=0;i<5;i++)cin>>pstr[i];
p=pstr;
sort(p);
for(int i=0;i<5;i++){
cout<<p[i]<<" ";
}
}
void sort(char **p){
char *temp;
for(int i=0;i<5;i++){
for(int j=i+1;j<5;j++){
if(p[i]>p[j]){
temp=p[i];
p[i]=p[j];
p[j]=temp;
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fan-jingwen/cpp.git
git@gitee.com:fan-jingwen/cpp.git
fan-jingwen
cpp
cpp
master

搜索帮助