Hi there,
I need to write two different functions. First one should ask the user's name and get it as input and in the second one I must call the user with their name and ask them their budget. But I have problems calling user with their name in the second function. Can anybody help?
#include <iostream>
#include <string>
usingnamespace std;
void getName(string&); // function prototype
int main()
{
string name;
getName(name); // calling the function getName;
....
....
} // end main
void getName(string& theName) // function definition start
{
cout << "Please type your name: ";
getline(cin, theName);
} // end function defintion
after the getName function has executed, any time you use name within the main it will use the name they entered.