Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string myName;
- // string myName = "";
- // string myName = "Bob";
- // string myName = NULL;
- void main()
- {
- SetPlayerName( GetPlayerName() );
- }
- string GetPlayerName()
- {
- // NOTE: Console::ReadLine() is a built in C++ function that waits for the user to enter text into the cmd console then press enter. this function gets the stuff they wrote as a return result.
- string tempString = Console::ReadLine();
- myName = tempString;
- return myName;
- // another way
- myName = Console::ReadLine();
- return myName;
- // another way
- return myName = Console::ReadLine();
- // best way
- return Console::ReadLine();
- }
- void SetPlayerName(string _name)
- {
- myName = _name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement