#include <windows.h>
#include <iostream>
#include <conio.h>
#include <time.h>
using namespace std;
const double matrixSizeY=7;
const double matrixSizeX=5;
double getMaxValue(double Matrix[7][5]){
double maxValue=0;
for(int x=0;x<matrixSizeX;x++)
for(int y=0;y<matrixSizeY;y++){
if(maxValue<Matrix[x][y])
maxValue=Matrix[x][y];
}
return maxValue;
}
int main(){
double Matrix[7][5];
srand((unsigned) time(0) );
/*
Matrix initialisieren....
*/
int RANGE_MIN = 0;
int RANGE_MAX = 100;
for(int x=0;x<matrixSizeX;x++)
for(int y=0;y<matrixSizeY;y++){
Matrix[x][y]= (((double) rand() / (double) RAND_MAX) * RANGE_MAX + RANGE_MIN);
}
cout<<endl<<endl;
for(int x=0;x<matrixSizeX;x++){
for(int y=0;y<matrixSizeY;y++)
cout<<Matrix[x][y]<<", ";
cout<<endl;
}
cout<<"Max Wert der Matrix ist: "<<getMaxValue(Matrix)<<endl;
return 0;
}
Lesezeichen