"Who are you, and where do you live?" — a Q&A exercise This is my first attempt at a programme. Is it good form?  Does it follow best practice? Or am I completely off the mark?

#include "stdafx.h"
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;Windows.h&gt;
using namespace std;

string a;
string b;

string enterName()
{
    while (true)
    {
        cout &lt;&lt; "what is your name?: ";
        getline(cin, a);
        if (a == "")
            cout &lt;&lt; "Let's try that again." &lt;&lt; endl;
        if (a != "")
            return a;
    }
}

string enterAge()
{
    while (true)
    {
       cout &lt;&lt; "What is your age " &lt;&lt; a &lt;&lt; "?: ";
        getline(cin, b);
        if (b == "")
            cout &lt;&lt; "You did not answer the question." &lt;&lt; endl;
        if (b != "")
            return b;
    }
}

int verifyAge()
{
    while (true)
    {
        int x = atoi(enterAge().c_str());
        if (x &gt; 0 &amp;&amp; x &lt; 95)
            return x;

        cout &lt;&lt; "That is not possible, put your real age please." &lt;&lt; endl;
    }
}

string address()
{
    while (true)
    {
        cout &lt;&lt; "Where do you live " &lt;&lt; a &lt;&lt; "?: ";
        string c;
        getline(cin, c);
        if (c == "")
            cout &lt;&lt; "You must live somewhere." &lt;&lt; endl;
        if (c != "")
            return c;
    }
}

int _tmain(int argc, _TCHAR* argv[])
{
    system("Color 1A");
    string a = enterName();
    cout &lt;&lt; endl;
    int y = verifyAge();
    cout &lt;&lt; endl;
    string c = address();
    cout &lt;&lt; endl;
    system("cls");
    cout &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "So your name is " &lt;&lt; a &lt;&lt; " you are " &lt;&lt; y &lt;&lt; " years old" 
        &lt;&lt; " and you live in " &lt;&lt; c &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "Press any key to exit";
    cin.get();
    return 0;
}
I have found a couple of things that could help you improve your code.

Don't abuse using namespace std

Putting using namespace std at the top of every program is a bad habit that you'd do well to avoid.  

Avoid the use of global variables

I see that a and b are declared as global variables rather than as local variables. It's generally better to explicitly pass variables your function will need rather than using the vague implicit linkage of a global variable. It's a bit strange because you have done that with variable c in your _tmain function. 

Use meaningful variable names

The variable names a, b, and c are not at all descriptive. Better names might be name, age and address.  Doing so makes your code easier to read, understand and maintain.

Don't use system("cls")

There are two reasons not to use system("cls") or system("Color 1A").  The first is that it is not portable to other operating systems which you may or may not care about now.  The second is that it's a security hole, which you absolutely must care about.  Specifically, if some program is defined and named cls or Color, your program will execute that program instead of what you intend, and that other program could be anything.  First, isolate these into a separate functions cls() and color() and then modify your code to call those functions instead of system.  Then rewrite the contents of those functions to do what you want using C++.  

General portability

This code could be made portable if, in addition to the changes in the previous point, you omit the Windows-only include files #include "stdafx.h" and #include &lt;Windows.h&gt; and use the standard int main() rather than the Windows-only _tmain.  See this stackoverflow question for a longer explanation.

Fix your formatting

There are abundant examples here of C++ code that is well formatted.  This code has peculiar indentation that makes it difficult to tell when a function begins and ends.  Fixing that would help.

Make it clear when loops end

The code currently uses while (true) in a number of places, but it doesn't really loop infinitely.  It's better, generally, to have the loop exit condition explicitly stated.  For example we could rewrite your enterName() function:

string enterName()
{
    do
    {
        cout &lt;&lt; "what is your name?: ";
        getline(cin, a);
        if (a == "")
            cout &lt;&lt; "Let's try that again." &lt;&lt; endl;
    } while (a == "");
    return a;
}


Variable range checking

Your verifyAge() routine seems to think that it's impossible for people to be 95 year old or older, but I personally know people that old who still use a computer.  A number of 130 might be a safer bet to use as an upper range.

In all, the program actually functions as intended, so you are indeed on your way.