I'm trying to make a function that makes the number of endlines put into the integer, but it gives me these weird errors. What's wrong with my code?

Code:
#include <cstdlib>
#include <iostream>

using namespace std;

int nl(int i)
{
int t = 0;

while (i >= t)
      {
      cout << endl;
      t++; 
      }
}

int main()
{
int i;    
    
cout << "Rock?";
cin  >> i; 
nl();
cout << "Pluck?";

cin  >> i;

return 0;
    
}