当前位置:网站首页>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");
}
}
边栏推荐
- Return of missing persons
- Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
- Priority queue (heap)
- nodejs_ fs. writeFile
- OpenGL - Model Loading
- Information and entropy, all you want to know is here
- Introduction Guide to stereo vision (6): level constraints and polar correction of fusiello method
- Editor use of VI and VIM
- Applet network data request
- Creation and reference of applet
猜你喜欢
The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis
Huber Loss
Huber Loss
Solution to the problems of the 17th Zhejiang University City College Program Design Competition (synchronized competition)
Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]
Confusion matrix
Rebuild my 3D world [open source] [serialization-1]
【ManageEngine】如何利用好OpManager的报表功能
nodejs_ fs. writeFile
Confusing basic concepts member variables local variables global variables
随机推荐
Summary and Reflection on issues related to seq2seq, attention and transformer in hands-on deep learning
Multiple solutions to one problem, asp Net core application startup initialization n schemes [Part 1]
Jenkins pipeline method (function) definition and call
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
File server migration scheme of a company
阿里云发送短信验证码
交通运输部、教育部:广泛开展水上交通安全宣传和防溺水安全提醒
2309. 兼具大小写的最好英文字母
OpenGL - Lighting
Applet data attribute method
我的一生.
AUTOSAR从入门到精通100讲(103)-dbc文件的格式以及创建详解
Rebuild my 3D world [open source] [serialization-3] [comparison between colmap and openmvg]
Use arm neon operation to improve memory copy speed
Ros-10 roslaunch summary
Nodejs modularization
asp. Net (c)
2310. The number of bits is the sum of integers of K
OpenGL - Model Loading
一文详解图对比学习(GNN+CL)的一般流程和最新研究趋势