calling a value from another method


if i have

1
2
3
4
void first_root()
{
	Root1=(-b+sqrt(d))/(2*a);
}


and i want to get the value for root one and print it in another void how is this possible?

would it be

1
2
3
4
void root1solution()
{
	cout << "Root 1:"<< first_root()<< endl;
}
Sounds like you need the function first_root to return a value.

This is really, really, really basic. You've got to help yourself first.
http://www.cplusplus.com/doc/tutorial/functions/
Topic archived. No new replies allowed.