Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#include "stdafx.h" Po co to?
- #include <iostream>
- using namespace std;
- const int WMAX = 50, KMAX = 20;
- int f1(float wektor[], int ile_el, float *suma) //ta funkcja rzekomo ma zwracac ile, ile to int, więc nie VOID (funkcja void nic nie wzraca) tylko INT!!!
- {
- *suma = 0;
- for (int i = 0; i < ile_el; i++)
- if (wektor[i] >= 3.51)
- *suma += wektor[i];
- int ile;
- ile = 0;
- for (int i = 0; i < ile_el; i++)
- if (wektor[i]> 0)
- ile++;
- return ile;
- }
- int main() //nie wiem co w srodku bylo, mi to jakos nigdy potrzebne nie bylo
- {
- float A[WMAX][KMAX];
- int m, n;
- cout << "Podaj liczbe wierszy: ";
- cin >> m;
- cout << "Podaj liczbe kolumn: ";
- cin >> n;
- wczytaj_macierz(A, m, n); //Nie wiem co gdzie i jak
- float suma_el;
- int liczba_el; //tutaj chyba ma byc int, bo liczba elementow to liczba calkowita
- f1(A[0], liczba_el, &suma_el); //pomyliles kolejnosc, zwracaj na to uwage, chciales przeslac 4 argumenty do funkcji ktora przyjmuje 3 - to blad!
- cout << "Suma elementow o wartosci conajmniej 3.51 wynosi: " << suma_el << endl;
- cout << "Liczba elementów dodatnich wynosi: " << liczba_el << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement