#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
//回文矩阵新写
//int main()
//{
// int i = 0;
// int j = 0;
// int n = 0;
// scanf("%d", &n);
// int top = 0;//标记起点;循环赋值的时候把起点与终点赋值给r让r移动赋值;因为当赋值完一圈之后要进入内圈赋值;所以把他们赋值给r是最好的选择;每次赋值完一圈之后起点加一,终点减一
// int bom = n - 1;//标记终点
// int arr[30][30] = { 0 };
// int r = 0;
// int count = 1;
// int x = n;//先把n赋值给x回头赋值一圈之后循环的次数就不在是n了而是n-1;因此要把n的值记住
// while (count <= n * n)//循环的条件当count<=n*n时赋值完毕跳出循环(因为时矩形所以最大的数就是n*n)
// {
// //给最外围一圈赋值
// for (r = top; r < x; r++)//最上行赋值
// {
//
// arr[top][r] = count++;//每次赋值完count+1
//
// }
// for (r = top+1; r < x; r++)//最右边赋值
// {
//
// arr[r][bom] = count++;
//
// }
// for (r = bom - 1; r >= top; r--)//最下边赋值
// {
//
// arr[bom][r] = count++;
//
// }
// for (r = bom - 1; r > top; r--)//最左边赋值
// {
//
// arr[r][top] = count++;
//
// }
// //第一圈赋值结束
// --bom;
// ++top;
// --x;
// //把变量重新设置一遍之后进入第二圈循环赋值
// }
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < n; j++)
//
// {
// printf("%d ", arr[i][j]);
//
// }
// printf("\n");
//
//
// }
//
//
//
// return 0;
//
//
//}
//蛇形矩阵
//pos=1 右上
//pos=-1 左下
//一共四个移动位置 左下;右上;右;下
//四种情况:碰到上界;下界;左界;右界
//1:上界并且列不等于n-1,那就需要行不变;列增加1
//2:下界;pos=1
//3:左界并且行小于n-1,行+1列不变
//4:右界pos=-1
//其余便是在中间移动
//当pos=1
//int main()
//{
// int i =0;
// int j = 0;
// int m = 0;
// int n = 0;
// int pos = 1;
// int arr[30][30] = { 0 };
// scanf("%d", &n);
// arr[0][0] = 1;
// int count = 2;
// while (count <= n * n)
// {
// if(i==0&&j<n-1&&pos==1)
// {
// arr[i][++j] = count++;
// pos = -1;
// }
// if (j == 0 && i < n-1 && pos == -1)
// {
//
// arr[++i][j] = count++;
// pos = 1;
// }
// if (i==n-1&&pos==-1)
// {
// arr[i][++j] = count++;
// pos = 1;
// }
// if (j == n - 1&&pos==1)
// {
// i = i + 1;
// arr[i][j] = count++;//第一次写写成了arr[++i][j]==count++了 多写了一个等号我真服了
// pos = -1;
// }
// if (pos == 1)
// {
// arr[--i][++j] = count++;
// }
// if (pos == -1)
// {
// arr[++i][--j] = count++;
// }
//
// }
//
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < n; j++)
// {
//
// printf("%d ", arr[i][j]);
//
// }
// printf("\n");
//
// }
//
// //printf("%d ", arr[2][3]);
//
//
//
//}
//int main()
//{
// int i, j, m, n;
// n = 0;
// int sum = 0;
// scanf("%d %m ", &n,&m);
// int arr[30][30] = { 0 };
// int arr1[30][30] = { 0 };
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < m; j++)
// {
//
// scanf("%d %d", &arr[i][j], &arr1[i][j]);
// if (arr[i][j] == arr1[i][j])
// {
//
// sum++;
//
//
// }
// }
//
//
// }
// float o = sum / n * m;
// printf("%.2lf ", sum);
// return 0;
//}
//
//
//
//
//
//
//
//int main()
//{
// int i = 0;
// int j = 0;
// int m = 0;
// int n = 0;
// int flag = 0;;
// int arr[30][30] = { 0 };
// scanf("%d", &n);
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < n; j++)
// {
//
// scanf("%d", &arr[i][j]);
//
// }
// }
// for (int k = 0; k < n; k++)
// {
// for (int r = k+1; r < n; r++)
// {
//
// if (arr[r][k] != 0)
// {
// flag = -1;
// goto end;
//
// }
// }
// }
//end:
// if (flag == -1)
// {
// printf("NO\n");
//
// }
// else
// printf("YES\n");
//
//}
//
//int main()
//{
// int i = 0;
// int j = 0;
// int m = 0;
// int n = 0;
// int j = 0;
// scanf("%d %d", &n,&m);
// int arr[30][30];
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < m; j++)
// {
// scanf("%d", &arr[i][j]);
//
//
// }
//
//
// }
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < m; j++)
// {
// printf("%d ", arr[i][j]);
//
//
// }
//
//
// }
//
//}
//
//
//#include <string.h>
//int main()
//{
// int tem = 0;
// int i = 0;
// int j = 0;
// int m = 0;
// int n = 0;
// //int j = 0;
// char l = 0;
// int a = 0;
// int b = 0;
// int ret1 = 33;
// scanf("%d %d", &n, &m);
// int arr[30][30];
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < m; j++)
// {
// scanf("%d", &arr[i][j]);
// }
// }//r代表行行,c代表列列
// int d = 0;
// scanf("d", &d);
// while (d > 0)
// {
// int ret = 99;
// scanf("%c", &l);
// scanf("%d %d", &a, &b);
// ret = strcmp("l", "r");
// ret1 = strcmp("l", "c");
//
// if (ret == 0)
// {
// for (i = 0; i < m; i++)//交换行
// {
// tem = arr[a][i];
// arr[a][i] = arr[b][i];
// arr[b][i] = tem;
// }
// }
// if (ret1 == 0)
// {
// for (j = 0; j < n; j++)//交换列
// {
// tem = arr[j][a];
// arr[j][a] = arr[j][b];
// arr[j][b] = tem;
// }
// }
// d--;
// }
// for (i = 0; i < n; i++)
// {
// for (j = 0; j < m; j++)
// {
// printf("%d", arr[i][j]);
// }
// printf("\n");
//
// }
// return 0;
//}
//
//
//
//
#include <stdio.h>
int main() {
int tem = 0;
int i = 0;
int j = 0;
int m = 0;
int n = 0;
char l = '0';
int a = 0;
int b = 0;
int ret1 = 33;
scanf("%d %d", &n, &m);
int arr[30][30];
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
scanf("%d", &arr[i][j]);
}
}//r代表行行,c代表列列
int d = 0;
scanf("%d", &d);
while (d > 0) {
scanf("%c", &l);
scanf("%d %d", &a, &b);
a = a - 1;
b = b - 1;
if (l == 'r') {
for (i = 0; i < m; i++) { //交换行
tem = arr[a][i];
arr[a][i] = arr[b][i];
arr[b][i] = tem;
}
}
if (l == 'c') {
for (j = 0; j < n; j++) { //交换列
int tem = 0;
tem = arr[j][a];
arr[j][a] = arr[j][b];
arr[j][b] = tem;
}
}
d--;
}
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
printf("%d ", arr[i][j]);
}
printf("\n");
}
return 0;
}
没有合适的资源?快使用搜索试试~ 我知道了~
个人C语言学习实录练习题-链表.数据结构.快速排序等.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共549个文件
tlog:107个
ipch:45个
c:39个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 5 0 下载量 9 浏览量
2024-05-22
09:42:35
上传
评论
收藏 61.88MB ZIP 举报
温馨提示
快速排序 个人C语言学习实录练习题-链表.数据结构.快速排序等.zip 个人C语言学习实录练习题-链表.数据结构.快速排序等.zip 个人C语言学习实录练习题-链表.数据结构.快速排序等.zip
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 549 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/d403eeff250e455e94ec717c3001b50e_2401_84585615.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
小王毕业啦
- 粉丝: 1642
- 资源: 227
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)