I need to create a function that reads from a file and displays name and hourly rate beneath a header.
Everything is in place, but I have to take my functions for getName() and getRate() and combine them. Any ideas? I tried creating a void readFile(string &name, float &rate), but how do I return values from a void?
@Garion You may return using pointers , references , or by actually returning. When you actually return you can only return one thing but using pointers and references you can return as many things as you want. You can return almost anything besides an array int [] function(); is invalid. You can also return references and pointers instead of copies.
@op you are already passing by reference which is the way you return in a function with no return type or you can use pointers:
With references you are really passing the memory address of that variable so when you modify it in the function it modifies it at that memory address so the actual variable being passed is then modified.