This is the first program I am writing after taking one C++ class 4 years back. Please help me with this syntax error:

#include <iostream>
#include <math.h>
using namespace std;

enum run {TERMINATE=0, LOOP, NoRoot};

double f (double x);
double f (double k);
double f (double n);
return (x*(1 + (k*n)/(1 + (k*x))));


double negative(double x) {
if(x > 0) {
return 1;
} else if(x < 0) {
return -1;
} else if(x == 0) {
return 0;
} else {
return x;
}
}

Error: missing ‘;’ before ‘return’

THANKS!

Recommended Answers

All 2 Replies

return (x*(1 + (k*n)/(1 + (k*x))));


that is not inside any function.

return (x*(1 + (k*n)/(1 + (k*x))));


that is not inside any function.

Thank you so much Ancientdragon! Off i go to bang my head against the next one.

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.