К<span> </span>фактам<span> </span>относятся <em />знания об определённых явлениях
<h2>поиск одинаковых строк в матрице</h2><h2>(c++)</h2>
#include <iostream>
#include <ctime>
#include <iomanip>
#include <vector>
using namespace std;
typedef vector< vector<int> > T;
ostream &operator<<(ostream &output,const T &mass)
{
for(size_t i = 0;i<mass.size();++i){
for(size_t j = 0;j<mass.size();++j)
output<<setw(5)<<mass[j];
output<<"\n\n";
}
return output;
}
int _tmain(int argc, _TCHAR* argv[])
{
srand((unsigned)time(0));
unsigned int row,col;
do{
cout<<"Enter rows > 0"<<endl;
cin>>row;
}while(row <= 0);
do{
cout<<"Enter col > 0"<<endl;
cin>>col;
}while(col <= 0);
T mass(row, vector<int>(col));
for(size_t i = 0;i < row;++i){
for(size_t j = 0;j < col;++j)
mass[j] = rand()%10;
}
cout<<mass;
return 0;
}
const nx =30;var i,j,n,a:integer;
M,B:array[1..nx] of integer;
begin
Randomize;
write('Введите число элементов массива n'); Read(n);
write('Введите число а '); Read(a);
for i:=1 to n do begin
M[i]:= random(10)-5;
if M[i] = a then begin j:=j+1;B[j]:=i;end;
write(M[i]:3);end;writeln;
for i:=1 to j do
writeln('Элемент массива совпадает а = ' ,a, ' на позиции ', B[i]);<span>end.</span>
Ответ:
Таблица находится во вложениях
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(0));
int a[10];
int b[10];
int c[10];
for (int i = 0; i < 10; i++)
{
a[i] = rand() % (90) + (10);
}
for (int i = 0; i < 10; i++)
{
cout << a[i] << " ";
}
cout << endl;
for (int i = 0; i < 10; i++)
{
cin >> b[i];
}
for (int i = 0; i < 10; i++)
{
c[i] = a[i] + b[i];
}
for (int i = 0; i < 10; i++)
{
cout << c[i] << " ";
}
system("pause");
}