Alright, there's some grave errors in your code.
First off, your function "firstPresident" isn't returning anything. All it's doing right now is taking in "first" and "last" from somewhere, and then reassigning it "Washington" and "George" and then not doing anything with it.
Secondly, with the way you defined your variables, "first" and "last" only exist in the scope of the function firstPresident. Once that function's done, "first" and "last" don't exist anymore (so you're couting something that doesn't exist).
Thirdly, "string" is a special variable type in C++ that doesn't exist without including a library, so you need to include <string>.
In my example I combined it into a single variable (since spaces are allowed in strings).
First, let's rewrite firstPresident to return "George Washington":
string firstPresident()
{
string name = "George Washington";
return name;
}
To cout the result of a function,which in our case is the string "George Washington", store the result of the function in some container and display it. You weren't storing the result of firstPresident() anywhere, but below I am storing it in "theName".
int main ()
{
string theName = firstPresident();
cout << theName << endl;
return 0;
}
Put it together:
#include <iostream>
#include <string>
using namespace std;
string firstPresident()
{
string name = "George Washington";
return name;
}
int main ()
{
string theName = firstPresident();
cout << theName << endl;
return 0;
}