Skip to content

Instantly share code, notes, and snippets.

@cymruu
Created October 16, 2017 20:18
Show Gist options
  • Save cymruu/4c72cec73afa55cef1184f4efeb2c0fc to your computer and use it in GitHub Desktop.
Save cymruu/4c72cec73afa55cef1184f4efeb2c0fc to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cmath>
void printArray(double **tab, size_t n, size_t k) {
for (size_t i = 0; i < n; i++)
{
for (size_t j = 0; j < k; j++)
{
std::cout << tab[i][j] << '\t';
}
std::cout << std::endl;
}
}
double findMax(double **tab, size_t n, size_t k) {
double max = 0;
for (size_t i = 0; i < n; i++)
{
for (size_t j = 0; j < k; j++)
{
if (max < tab[i][j]) {
max = tab[i][j];
}
}
}
return max;
}
int main()
{
//metoda eliminacji guassa
size_t n = 3;
size_t k = 3;
double **A = new double *[n];
for (size_t i = 0; i < n; i++)
{
A[i] = new double[k];
for (size_t j = 0; j < k; j++)
{
//A[i][j] = 2.0;
}
}
unsigned int r = 0;
double max = 0;
A[0][0] = 3;
A[0][1] = -4;
A[0][2] = 8;
A[1][0] = 2;
A[1][1] = -1;
A[1][2] = 5;
A[2][0] = -5;
A[2][1] = -5;
A[2][2] = -15;
printArray(A, n, k);
for (size_t i = 0; i < n; i++){
cou
}
/*std::cout << "max: " << findMax(A, n, k);*/
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment