I'm fairly new to C++. I'm working on a few assignments but I'm having trouble with each of them. Just so everything gets explained thoroughly I'll post the assignments along with what I've coded and what I'm having problems with. The first assignment is this:

Write a C++ program to input ten integer numbers into an array named fmax and determine the maximum value entered. Your program should contain only one loop and the maximum should be determined as array element values are being input.

I ran the program but received a bunch of errors. I'm not sure what I'm doing wrong. I'm having the most problems with this program. This is what I coded so far:

Code:
#include <iostream>
using namespace std;

int findMax(int [], int);  

int main()
{
  const int NUMPTS = 10;
  int i, nums[NUMPTS], total = 0;
  cout << "Enter a number: ";
  cin >> nums;
  
  {  
  cout << "\nThe maximum value is "
       << findMax(nums,NUMPTS) << endl;
       
  return 0;
}
int findMax(int vals[], int numels);
{
  int i, max = vals[0];
  
  for (i = 1; i < numels; i++)
    if (max < vals[i]) max = vals[i];
    
  return max;
}
The next assignment runs but I'm not receiving the answer I'm supposed to. The assignment is:

Modify the findMax() function in Program 8.4 to locate the minimum value of the passed array.

I modified the program and the output is supposed to be 1 but for some reason I'm getting 2. Here is what I coded:

Code:
#include <iostream>
using namespace std;

const int MINNUM = 5;

int findMin(int [MINNUM]);      

int main()
{
  int nums[MINNUM] = {2, 18, 1, 27, 16};

  cout << "The minimum value is " << findMin(nums) << endl;

  return 0;
}


int findMin(int vals[MINNUM])
{
  int i, min = vals[0];

  for (i = 1; i >= MINNUM; i++)
    if (min >= vals[i]) min = vals[i];

  return min;
}
Here is the last assignment:

Write a declaration to store the string “This is a sample” into an array named samtest. Include the declaration in a program that displays the values in samtest using a for loop that uses a pointer access to each element in the array.

I'm not sure if I coded this correctly or not. My end results displays the message with one letter per line. Here is my code:

Code:
#include <iostream>
using namespace std;

int main()
{
  
	const char samtest[] = {"This is a sample"};
	int i;

	cout << "The elements in the array are: " << endl;
	for(i = 0; i <= 16; ++i)
		cout << *(samtest + i) << endl;

	return 0;
}
If anyone could explain to me what I'm doing wrong for any of these it would help me a lot. Thanks in advance.