check the input empty in string

hey guys
I have a program asking the user to input his name in string but I wannna quiet the program if the user didnt enter any things or numbers?

can you please help me!!!!!
Google is your friend :D

http://www.cplusplus.com/reference/string/string/empty/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string x;
	getline(cin, x);
	if (x.empty())
		return 0;
	else
	{
		cin.ignore();
		cin.get();
	}
}
Topic archived. No new replies allowed.