#include <stdio.h>
#include <string.h>
#include <ctype.h>
int getemail (char * email);
int getfirstname (char* firstname);
int getlastname(char * lastname);
int getphonenumber (char * phone);
void main ()
{
char email[30];
char firstname[80];
char lastname[80];
char phone[15];
int namevalid;
do {
namevalid=getfirstname(firstname);
if (namevalid ==1){
printf("You entered: %s, A good name\n",firstname);
}
else {
printf("You entered an INVALID name\n");
}
}
while (namevalid ==0);
}
int getfirstname (char * chararry);
{ int entryvalid =1;
int entrylength;
printf("enter the first name: ");
gets(chararray);
printf("You entered: %s\n",chararray);
//strlen give the length of an array of characters
entrylength-strlen(chararray);
if (entrylength ==0) {
return 0;
}
for (i =0; i< entrylengthl i++) {
if (chararray[i]== ' ')
entryvalid=0;
}
if (!isalpha(chararray[i])) {
enrtyvalid=0;
}
}
return entryvalid;
MrBentley 0 Newbie Poster
MrBentley 0 Newbie Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
MrBentley 0 Newbie Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.