当前位置:网站首页>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");
}
}
边栏推荐
- Pearson correlation coefficient
- Introduction Guide to stereo vision (3): Zhang calibration method of camera calibration [ultra detailed and worthy of collection]
- np.allclose
- Luo Gu p3177 tree coloring [deeply understand the cycle sequence of knapsack on tree]
- Ros- learn basic knowledge of 0 ROS - nodes, running ROS nodes, topics, services, etc
- AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
- Jenkins pipeline method (function) definition and call
- Editor use of VI and VIM
- [code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
- 【ManageEngine】如何利用好OpManager的报表功能
猜你喜欢
The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis
Ros-11 common visualization tools
Applet (global data sharing)
信息與熵,你想知道的都在這裏了
Nodejs modularization
Hosting environment API
Applet network data request
【阅读笔记】图对比学习 GNN+CL
Nodemon installation and use
OpenGL - Coordinate Systems
随机推荐
2309. The best English letters with both upper and lower case
AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
Configuration and startup of kubedm series-02-kubelet
Kubedm series-00-overview
Blue Bridge Cup provincial match simulation question 9 (MST)
图神经网络+对比学习,下一步去哪?
云计算技术热点
OpenGL - Lighting
Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
c#比较两张图像的差异
Causes and appropriate analysis of possible errors in seq2seq code of "hands on learning in depth"
信息与熵,你想知道的都在这里了
Using request headers to develop multi terminal applications
Huber Loss
Illustrated network: what is gateway load balancing protocol GLBP?
Shutter uses overlay to realize global pop-up
3D reconstruction open source code summary [keep updated]
Ros-10 roslaunch summary
2311. 小于等于 K 的最长二进制子序列
scipy.misc.imread()