当前位置:网站首页>C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边
C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边
2022-07-05 09:15:00 【Robbin_mi】
#include <stdio.h>
int main()
{
int a[3][5]={ 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5};
int j,i,b,z,num=0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 5; j++) {
printf("%2d", a[i][j]);
num++;
}
if (num % 5 == 0) printf("\n");
}
printf("--------------------\n");
int a[3][5]={ 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5};
int j,i,b,z,num=0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
b = a[i][0];
for (z = 1; z < 5; z++) {
a[i][z - 1] = a[i][z];
}
a[i][4] = b;
}
}
for (i = 0; i < 3; i++) {
for (j = 0; j < 5; j++) {
printf("%2d", a[i][j]);
num++;
}
if (num % 5 == 0) printf("\n");
}
}
边栏推荐
- Solution to the problems of the 17th Zhejiang University City College Program Design Competition (synchronized competition)
- Progressive JPEG pictures and related
- The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis
- 驾驶证体检医院(114---2 挂对应的医院司机体检)
- 顶会论文看图对比学习(GNN+CL)研究趋势
- uni-app 实现全局变量
- C#图像差异对比:图像相减(指针法、高速)
- Explain NN in pytorch in simple terms CrossEntropyLoss
- C#绘制带控制点的Bezier曲线,用于点阵图像及矢量图形
- Multiple linear regression (sklearn method)
猜你喜欢
Wxml template syntax
Progressive JPEG pictures and related
fs. Path module
一文详解图对比学习(GNN+CL)的一般流程和最新研究趋势
OpenGL - Lighting
高性能Spark_transformation性能
Svgo v3.9.0+
[code practice] [stereo matching series] Classic ad census: (5) scan line optimization
Applet (subcontracting)
Summary of "reversal" problem in challenge Programming Competition
随机推荐
Introduction Guide to stereo vision (1): coordinate system and camera parameters
. Net service governance flow limiting middleware -fireflysoft RateLimit
Jenkins pipeline method (function) definition and call
File server migration scheme of a company
Svg optimization by svgo
NIPS2021 | 超越GraphCL,GNN+对比学习的节点分类新SOTA
Information and entropy, all you want to know is here
Meta tag details
Solution to the problems of the 17th Zhejiang University City College Program Design Competition (synchronized competition)
Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
Composition of applet code
Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
迁移学习和域自适应
Using request headers to develop multi terminal applications
2310. The number of bits is the sum of integers of K
OpenGL - Model Loading
Multiple linear regression (sklearn method)
高性能Spark_transformation性能
Return of missing persons
Codeworks round 681 (Div. 2) supplement