I need some help. This is what I have to do:
I have to validate data. There are several fields:
* ID Number (7 characters, first 2 have to be capital letters, next five have to be digits)
* Familyname (basically have to be letters e.g. Liddel hart, Forth-Jones, letter - case doesn’t matter)
* Given names (Same as for Familyname)
* Gender (capital M or F)
Here is an example of what would be considered valid input:
Anything that would differ from above is invalid input. No input should be longer than 90 characters,
I have done some code for this problem....
#define RECORDSIZE 100
void getRecord(char *record);
int validateRecord(char *record);
void getRecord(char *record)
printf("Please enter record string\n");
if (fgets(record, RECORDSIZE, stdin) == NULL)
printf("Failed to read in record\n");
int validateRecord(char *record)
.... But as u can see I need to still fill in the validateRecord function. This is where i have to determine if the input matches up the field specifications.
Can anybody give some help as to how I would go about doing this?