#include <iostream>
using namespace std;

float *findMax(float A[], int n){
	float *theMax=&A[0];
	for(int i=1;i<n;i++){
		if(A[i]>*theMax){
			theMax=&(A[i]);
		}
	}
	return theMax;
}

float *get_square(float A[], int n){
	float *b=new float[n];
	for(int i=0;i<n;i++){
		b[i]=A[i]*A[i];
	}
	return b;
}

int main(){
	float A[5]={0.0,3.0,1.5,2.0,4.1};
	int size=5;
	cout<<"---SENARIO 1: Finding the Max---"<<endl;
	float *maxA;
	maxA=findMax(A,size);
	cout<<"The max value is: "<<*maxA<<endl;
	*maxA=*maxA+1.0;
	cout<<"We increades the max value by 1. New value: "<<*maxA<<endl<<endl;
	cout<<"---SENARIO 2: Return new Array---"<<endl;
	float *c;
	c=get_square(A,size);
	float *original_c=c;
	cout<<"The squares of the values are: "<<endl;
	int i=0;
	while(i<size){
		cout<<*c<<endl;
		c++;
		i++;
	}
	delete[] original_c;
	return 0;
}
