#include<iostream>
#include <cstring>
#include<cmath>
#include<cstdlib>
#include<conio.h>
#include<ctime>
#include<windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUS");
srand(time(NULL));
const int n = 5;
double a[n][n], buf;
int k = 1;
cout << "Массив a" << endl;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
a[i][j] = rand() % 20 - 10;
cout << "a[" << i << "][" << j << "] = " << a[i][j] << "\t";
}
cout << endl;
cout << endl;
}
for (int i = 0; i < n; i++)
{
for (int j = n - 1; j > i; j--)
{
if (a[i][n - 1 - i + k] > a[i + 1][n - 1 - i + k - 1])
{
buf = a[i][n - 1 - i + k];
a[i][n - 1 - i + k] = a[i + 1][n - 1 - i + k - 1];
a[i + 1][n - 1 - i + k - 1] = buf;
}
}
}
cout << endl;
cout << "Отсортированная параллель побочной диагонали расположенной под диагональю" << endl;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cout << "a[" << i << "][" << j << "] = " << a[i][j] << "\t";
}
cout << endl;
cout << endl;
}
system("PAUSE");
}
#include<iostream>
#include <cstring>
#include<cmath>
#include<cstdlib>
#include<conio.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUS");
const int n = 5;
double b[5], c[5];
int i, a = 0, g = 0;
for (i = 0; i < n; i++)
{
cout << "Массив b = " << endl;
cin >> b[i];
if (b[i] > 0)
{
for (a; a <= i; a++)
{
c[a] = pow(b[i], 2);
g++;
}
a = g;
}
cout << "Результат сжатия = " << c[a-1] << endl;
}
system("PAUSE");
}
#include<iostream>
#include <cstring>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include <string>
#include<conio.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUS");
char x;
int a = 97, b = 98;
do {
cout << "Введите букву = " << endl;
cin >> x;
if (x = 'a')
{
x = b;
cout << "работа программы = " << x << endl;
}
else {
cout << "работа программы = " << x << endl;
}
} while (x != '.');
system("PAUSE");
}