lab7-921

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <time.h> using namespace std; int main() { srand((unsigned) time(NULL)); int table[5][5]; int max,row,col; //filling table for(int i=0; i<5;i++) { for(int j=0;j<5;j++) table[i][j]=rand()%50+2; } //show content for(int i=0; i<5;i++) { for(int j=0;j<5;j++) cout<<" "<<table[i][j]; cout<<endl; } //find the max max=table[0][0]; for(int i=0;i<5;i++) for(int j=0;j<5;j++) { if(table[i][j]>max) { max=table[i][j]; row=i; col=j; } } cout<<"Maximum element :["<<row+1<<"]["<<col+1<<"]"<<endl; cout<<"Max="<<max<<""<<endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines