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

int n ,sum(1),k;

cout <<"Please enter an integer n "<< endl;
cin  >> n >>endl; 
for(k=1;k<=n;k++)
{
		sum +=(1/(1*(k+1)));
}
cout << "The sum = " << sum <<endl;

return 0;
}

It does not recognize the input operator >> when it compiles

change the line cin >> n >>endl;
as cin >> n;

cin can work like this
cin >> param1 >> param2 >> param3;

I think it's obvious that you cannot use endl with cin...

it worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.