Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main() {
- srand(time(NULL));
- float tab[6][4];
- // Tworzenie tablicy
- for (int i = 0; i< 6;i++){
- for (int j = 0; j< 4;j++) {
- float los = -2 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(6+2)));
- tab[i][j] = los;
- }
- }
- // 1.
- for (int i = 0; i< 6;i++){
- for (int j = 0; j< 4;j++) {
- cout << tab[i][j] << " ";
- }
- cout << "\n";
- }
- // 2.
- float ilo = 1;
- for (int i = 0; i< 6;i++){
- for (int j = 0; j< 4;j++) {
- if (j % 2 == 0) {
- ilo *= tab[i][j];
- }
- }
- }
- cout << ilo << "\n";
- // 3.
- int mniejszeOdDwa = 0;
- for (int i = 0; i< 6;i++){
- for (int j = 0; j< 4;j++) {
- if (tab[i][j] < 2) {
- mniejszeOdDwa++;
- }
- }
- }
- cout << mniejszeOdDwa << "\n";
- // 4. za trdudne
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement