Hello , I am new to programming and i'm really stuck!
Our teacher gave us a problem , i'm so close to finishing it , but the last part says:
- "Create a function max_vector and a function sum_vector , from what you have typed in read_vector , find the max vector and the sum of the values of the vector".
P.S. i can't link the whole problem because she said if she sees it on the internet we will get a very bad note.
So i will try to post the best as i can..:
void read_vector()
{
//here you get the values that you type , as well as how many values your vector will have ( example: i typed 1,2 and 3 but note that there can be even 5 values in the vector , like for example: 1,2,4,5 depending on how many you want to type)
}
void max_vector()
{
//search the highest value of the vector that you typed ( example: 3 for us )
}
int sum_vector()
{
//make a sum of any typed numbers ( 1+2+3 = 6 ).
}
int main()
{
cout<<"...";
read_vector();
max_vector();
sum_vector();
}
I only need max_vector and sum_vector
to note that my vector si v[20] and i have the variables a and i.
P.S.S. I also can't copy paste because it's a very big code , and many parts not in english , except for the programming(cout, naming of vectors etc).
Also i know how to to all those , but i do not know how to take the values out of the read_vector(); function , we can't have stable values , the user can type what numbers he/she wishes to , he/she must still get the highest a number and the b sum.
TL;DR: how do i take the values i typed in the function x and add it to y and z ( for y i need to search the highest number in x and for z to make the sum of x elements ).
Please help..