先上程序
#include <iostream>
using namespace std;
int main()
{
int q = 0;
char x[100] = { 0 };
cin >> x;
for (int i = 0; i < 100; i++)
{
if (x[i] == 0)
{
q = i;
break;
}
if (a[i] == a)
{
a[i] = z;
}
if (a[i] == A)
{
a[i] = Z;
}
if (a[i] >= 98 && a[i] <= 122)
{
a[i] = a[i] - 1;
}
if (a[i] >= 66 && a[i] <= 90)
{
a[i] = a[i] - 1;
}
for (int j = 0; j < q + 1; j++)
{
cout << x[j];
}
return 0;
}
实现两个二维数组的乘法
说明:这个程序只能实现方阵相乘。
#include <iostream>
using namespace std;
int main()
{
int m, n;
cin >> m >> n;
int a[100][100] = { 0 };
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
cin >> a[i][j];
}
int x, y;
cin >> x >> y;
int b[100][100] = { 0 };
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
cin >> b[i][j];
}
int c[100][100] = { 0 };
for (int i = 0; i < m; i++)
{
for (int j = 0; j < y; j++)
{
int s = 0;
for (int p = 0; p < y; p++)
{
s += a[i][p] * b[p][j];
}
c[i][j] = s;
}
}
for (int i = 0; i < m; i++)
{
for (int j = 0; j < y; j++)
{
cout << c[i][j] << " ";
}
cout << endl;
}
}
拜~