-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChenCot.cpp
45 lines (41 loc) · 906 Bytes
/
ChenCot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
using namespace std;
void inputArray(int arr[][100], int m, int n)
{
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
cin >> arr[i][j];
}
void replaceArray(int arr[][100], int m, int n, int x, int y)
{
for (int i = 0; i < m; i++)
for (int j = n; j >= x; j--)
{
arr[i][j] = arr[i][j - 1];
}
for (int i = 0; i < m; i++)
{
arr[i][x - 1] = y;
}
}
void outputArray(int arr[][100], int m, int n)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
cout << arr[i][j] << " ";
cout << endl;
}
}
int main()
{
int m, n;
cin >> m >> n;
int arr[100][100];
inputArray(arr, m, n);
int x, y;
cin >> x >> y;
replaceArray(arr, m, n, x, y);
outputArray(arr, m, n + 1);
return 0;
}