当前位置:网站首页>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");
}
}
边栏推荐
- .NET服务治理之限流中间件-FireflySoft.RateLimit
- How many checks does kubedm series-01-preflight have
- asp. Net (c)
- Progressive JPEG pictures and related
- Editor use of VI and VIM
- 利用请求头开发多端应用
- Applet network data request
- Codeworks round 681 (Div. 2) supplement
- Solution to the problem of the 10th Programming Competition (synchronized competition) of Harbin University of technology "Colin Minglun Cup"
- Codeworks round 638 (Div. 2) cute new problem solution
猜你喜欢
Hosting environment API
Confusion matrix
Introduction Guide to stereo vision (5): dual camera calibration [no more collection, I charge ~]
Introduction Guide to stereo vision (7): stereo matching
[code practice] [stereo matching series] Classic ad census: (4) cross domain cost aggregation
Introduction Guide to stereo vision (2): key matrix (essential matrix, basic matrix, homography matrix)
Generate confrontation network
Programming implementation of ROS learning 5-client node
生成对抗网络
Using request headers to develop multi terminal applications
随机推荐
Use and programming method of ros-8 parameters
Codeforces Round #648 (Div. 2) E.Maximum Subsequence Value
牛顿迭代法(解非线性方程)
RT thread kernel quick start, kernel implementation and application development learning with notes
Editor use of VI and VIM
Introduction Guide to stereo vision (4): DLT direct linear transformation of camera calibration [recommended collection]
Array, date, string object method
c#比较两张图像的差异
Rebuild my 3D world [open source] [serialization-1]
OpenGL - Model Loading
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
我的一生.
信息与熵,你想知道的都在这里了
Characteristic Engineering
np. allclose
Mengxin summary of LCs (longest identical subsequence) topics
TF coordinate transformation of common components of ros-9 ROS
Confusing basic concepts member variables local variables global variables
Explain NN in pytorch in simple terms CrossEntropyLoss
2311. Longest binary subsequence less than or equal to K