Hello,
I've written a simple C++ code for taking values from user. But I need little help with validation. I want to check null validation only.
Here is the partial code -
This is only that part of code. Now what I need is to check if the user haven't entered anything (i.e. name == null something)
The problem I'm getting is, whenever I run the program, and Hit Enter key without entering anything, the program crashes.. I need help with null validation.
I've written a simple C++ code for taking values from user. But I need little help with validation. I want to check null validation only.
Here is the partial code -
Code:
char name[20];
char surname[20];
char city[20];
cout<<"\n\t\tFirst Name : ";
gets(name);
cout<<"\n\t\tSurname : ";
gets(surname);
cout<<"\n\t\tCity : ";
gets(city);
This is only that part of code. Now what I need is to check if the user haven't entered anything (i.e. name == null something)
The problem I'm getting is, whenever I run the program, and Hit Enter key without entering anything, the program crashes.. I need help with null validation.