SOCKET Connections[100];// массив сокетов подключения
int Counter = 0; // индекс соединения
void ClientHandler(int index) {
char msg[256];
while (true) {
recv(Connections[index], msg, sizeof(msg), NULL);
for (int i = 0; i < Counter; i++) {
send(Connections[i], msg, sizeof(msg), NULL);
}
}
}
SOCKET Connections[100];// массив сокетов подключения
int Counter = 0; // индекс соединения
void ClientHandler(int index) {
char msg[256];
while (true) {
if(!isAvailable[index])
countinue;
recv(Connections[index], msg, sizeof(msg), NULL);
for (int i = 0; i < Counter; i++) {
send(Connections[i], msg, sizeof(msg), NULL);
}
}
}
sudo apt-get install gcc
dpkg -i *dependencypacket1*.deb *dependencypacket2*.deb ... *dependencypacketN*.deb *gcc*.deb
find / *gcc*.deb
chmod +x installgcc.sh
./installgcc.sh
//g++ 7.4.0
https://qna.habr.com/q/1088148
#include<iostream>
#include <cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<vector>
#include <bits/stdc++.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;
}
vector<double> vd;
for (int i = 0; i < n; i++)
{
for (int j = 0;j<n;j++)
{
if(i==j)
break;
if(i==j+1)
vd.push_back(a[i][j]);
}
}
sort(vd.begin(), vd.end());
for(int i=0;i<vd.size();i++)
cout <<vd[i]<< endl;
k=0;
for (int i = 0; i < n; i++)
{
for (int j = 0;j<n;j++)
{
if(i==j)
break;
if(i==j+1){
a[i][j] = vd[k];
k++;
}
}
}
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;
}
}