I am very new to C++, and I need help to make these conditions part of my code that I have created so far. I'm very stuck, so please help as soon as possible, thanks!
Assignment and Guidelines that I still need to meet:
In this assignment, you will simulate a H.R. employee data file which can
be searched for data associated with other data. For example, if you input
a name you can get an address or vice-versa etc. Accept all names regardless of case. Test for and reject all inputs containing invalid characters. Limit the uid input to 4 digits only. If an invalid input is detected, display the input and ask for a valid input. The name cannot contain any data type other than alpha characters. Likewise, the uid can only contain digits. Invalid inputs must not "crash" or "loop" the system or in any way cause the program to end.
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
struct customerRecords
{
int uid;
char name[100];
};
void findData(struct customerRecords db[])
{
while (true)
{
char value[100];
int uid = 0;
cout << "Enter uid or name: ";
cin >> value;
if (strcmp(value, "-1") == 0)
{
return;
}
//dig and alph are both counters
int dig = 0;
int alph= 0;
for ( int i = 0; i < strlen (value) ; i++)
{
if (isdigit(value[i])) dig++;
else if (isalpha(value[i])) alph++;
}