#include <iostream>
#include <string>

using namespace std;

double& refMin (double&, double&);
string& message ();
void toUpper (string&);

int main()
{
	double x1 = 1.1, x2 = 1.6, y;

	y = refMin (x1, x2);
	cout << "x1= " << x1 << " x2= " << x2 << endl;
	cout << "Minimum: " << y << endl;

	++refMin (x1, x2);
	cout << "x1= " << x1 << " x2= " << x2 << endl;
	cout << "Minimum: " << y << endl;

	y = refMin (x1, x2);
	cout << "x1= " << x1 << " x2= " << x2 << endl;
	cout << "Minimum: " << y << endl;

	message() = "warm";
	message() += "nein";
	cout << "Länge: " << message().length() << endl;

	string text ("Test with operators");
	toUpper (text);
	cout << text << endl;
	toUpper (text = "sour");
	cout << text << endl;
	toUpper (text += "makes funny");
	cout << text << endl;
	
	return 0;
}

double& refMin (double& a, double& b)
{
	return a<= b ? a : b;
}

string& message ()
{
	static string str = "kalt";
	return str;
}

void toUpper (string& str)
{
	int len = str.length();
	for (int i=0; i< len; i++)
	{
		str[i] = toupper (str[i]);
	}
}


