// for_cycle_max.cpp
//
#ifdef _WIN32
	#include <tchar.h>
	#include <conio.h>
#elif (defined __linux__) || (defined _AIX) || (defined __APPLE__)
	typedef char _TCHAR;
	#define _tmain main
#endif

#include <stdio.h>
#include <float.h>
#include <iostream>
using namespace std;

void my_getch();

int _tmain(int argc, _TCHAR* argv[])
{
	unsigned n, i;
	float x, max;

	cout << "\n Tento program nacita kladne cele cislo \"n\" a potom n"
		<< " realnych cisel.\nNajdite maximum tychto cisel.";
	cout << endl << " Zadajte pocet cisel! n = ";
	cin >> n;

	if (n > 0) {
		max = FLT_MIN;
		for (i = 0; i < n; i++) {  // i++ znamena i = i+1
			cout << " x = ";
			cin >> x;
			if (x > max)
				max = x;
		}
		cout << endl << " Maximalne cislo je " << max << ".";
	}
	else
		cout << endl << " Nezadali ste ziadne cisla.";

	my_getch();
	return 0;
}

void my_getch()
{
#ifdef _WIN32
	_getch();
#else
	cout << endl;
#endif
}
//---------------------------------------------------------------------------
// Ulohy:
// 1) Vypiste aj poradove cislo prveho a posledneho vyskytu maximalneho prvku.
// 2) For-cyklus prerobte na While-cyklus.
// 3) For-cyklus prerobte na Do-while-cyklus.