how to write the fibonacci series by accepting the value of terms of the series from the user?

#include<iostream>
using namespace std;
int main(){

   int num,first=0,second=1,next;
   cout << "Enter the number " << endl;
   cin >> num;
   cout << "First "<<num<<"terms of Fibonacci series are :-"<<endl;
   for ( int loop=0;loop<num;loop++){

         next=first+second;
         first=second;
         second=next;

      cout<<next<<endl;
   }
}