Created
October 4, 2017 12:51
-
-
Save cymruu/22cd4ca921c5a4f1cd017c37a41835dd 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 <iostream> | |
#include <ctime> | |
//grupa a | |
//1 jednowymiarowa | |
using namespace std; | |
void zadanie1(int *tab, unsigned int size) { | |
int max = INT32_MIN; | |
for (size_t i = 0; i < size; i++) | |
{ | |
if (!(*(tab + i) % 2)) { | |
if (max < *(tab + i))max = *(tab + i); | |
} | |
} | |
//cout << "Najwieksza liczba parzysta w tablicy: " << max; | |
} | |
void zadanie2() { | |
int tab[4][5]; | |
for (size_t i = 0; i < 4; i++) | |
{ | |
for (size_t j = 0; j < 5; j++) | |
{ | |
tab[i][j] = (rand() % 10)+1; | |
cout << tab[i][j] << "\t"; | |
} | |
cout << "\n"; | |
} | |
int maxI = INT32_MIN; | |
int index = 0; | |
for (size_t i = 0; i < 4; i++) | |
{ | |
int iloczyn = 1; | |
for (size_t j = 0; j < 5; j++) | |
{ | |
iloczyn *= tab[i][j]; | |
} | |
cout << "iloczyn: " << i << " " << iloczyn << endl; | |
if (maxI < iloczyn) { maxI = iloczyn; index = i; } | |
} | |
cout << "Najwiekszy iloczyn znaleziony w wierszu: " << index+1 << ", wynosi: " << maxI<< endl; | |
} | |
int main() | |
{ | |
srand(time(nullptr)); | |
unsigned int size = 10; | |
int *arr = new int[size]; | |
for (size_t i = 0; i < size; i++) | |
{ | |
*(arr + i) = rand() % 50; | |
} | |
zadanie1(arr, size); | |
delete arr; | |
zadanie2(); | |
//zadanie 3 a | |
void* fx(double *j, int(*)(int i)); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment