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;
}