The usage of newcordinate in Test::setcoordinate() is local to that function. To use a variable with that name in main(), you need to change main() to read something like;
Code:
int main()
{
Test number;
double newcoordinate;
number.setcoordinate(newcoordinate);
return 0;
}
That will shut up the compiler, at least.
You're mixing up a couple of practical things in your code though; I suggest removing responsibility from your Test class to read value of a coordinate. That means, firstly, changing Test::setcoordinate() to something like;
Code:
void Test::setcoordinate(double newcoordinate)
{
coordinate = newcoordinate;
}
and changing main() to;
Code:
int main()
{
Test number;
double newcoordinate;
cout<<"please give coordinate"<<'\n';
cin>>newcoordinate;
number.setcoordinate(newcoordinate);
cout<<"The number you gave is"<< number.getcoordinate()
<< " which should be the same as " << newcoordinate << '\n';
return 0;
}