-
-
Save pereslavtsev/7812444 to your computer and use it in GitHub Desktop.
Программа Влада
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <iomanip> | |
#include <iostream> | |
using namespace std; | |
const int n=6; | |
const int m=6; | |
struct funk | |
{ | |
int kolvo; | |
int numb; | |
}; | |
void zap(int **mas, int n, int m) | |
{ | |
for(int i=0; i<=n-1; i++) | |
{ | |
for(int k=0; k<=m-1; k++) | |
{ | |
mas[i][k]=(rand()%9)+1; | |
} | |
} | |
} | |
void printm(int **mas, int n, int m) | |
{ | |
for(int i=0; i<=n-1; i++) | |
{ | |
for(int k=0; k<=m-1; k++) | |
{ | |
cout<<mas[i][k]<<" "; | |
} | |
cout<<endl; | |
} | |
} | |
void result (int**mas, int n, int m, funk *mas2) | |
{ | |
int min, k=0, g=0; | |
for(int i=0; i<=n-1; i++) | |
{ | |
min=mas[i][0]; | |
for(int k=0; k<=m-1; k++) | |
{ | |
if (mas[i][k]<min) | |
{ | |
min=mas[i][k]; | |
} | |
} | |
mas2[g].kolvo=min; | |
mas2[g].numb=i; | |
g++; | |
} | |
cout<<endl; | |
for(int i=0; i<=g-1; i++) | |
{ | |
cout<<mas2[i].numb<<" "; | |
} | |
cout<<endl; | |
for(int i=0; i<=g-1; i++) | |
{ | |
cout<<mas2[i].kolvo<<" "; | |
} | |
} | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
setlocale(LC_ALL, "Rus"); | |
srand(time(0)); | |
funk *mas2; | |
mas2=new funk[n*m]; | |
int **mas; | |
mas=new int*[n]; | |
for(int i=0; i<=n-1; i++) | |
{ | |
mas[i]=new int[m]; | |
} | |
zap(mas,m,n); | |
printm(mas,m,n); | |
result(mas,m,n,mas2); | |
cin.get(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment