Help with Functions

So Im having trouble with this function. when I try and use this function it gives me an error. I cant figure out what Im doing wrong, this is my first time working with functions so I imagine its a simple error. Any help is appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
double userinput(double a1); // declaration

	double q = userinput(a1); //use 1 (This is where my error is occurring 'a1 is undeclared') 
	double w = userinput(a1); // use 2 (This is where my error is occurring)
	double e = userinput(a1); // use 3 (This is where my error is occurring)

double userinput(double a1) {                          // function code
	string a;
	cout << "Please enter center coordinate: ";
	cin >> a;
	a1 = stof(a);

	return a1;
}
Last edited on
closed account (48T7M4Gy)
im having trouble with this bit of code

So what's the trouble?
Have you set a value for PI?
double radians = angle * PI / 180; perhaps?
Last edited on
closed account (48T7M4Gy)
Hey don't double post . It wastes people's time and effort and changing your origunal post to this latest one is gross. :(

http://www.cplusplus.com/forum/beginner/177574/
Last edited on
Topic archived. No new replies allowed.