Znajdowanie minimum z n liczb – przykład 1

#include <iostream>
using namespace std;

int funkcja_min(int n)
{
int x, xmin;
for(int i=0; i<n; i++)
{
cout << “Podaj liczbe ” << i+1 << “: “;
cin >> x;
if(i==0)
xmin=x;
else
if(x<xmin)
xmin=x;
}
return xmin;
}

int main ()
{
int ile;
cout << “Podaj ile bedzie liczb: “;
cin >> ile;
cout << “Zacznij podawanie liczb: \n”;
cout << “Najmniejsza liczba to: ” << funkcja_min(ile);
}