如果一无所有,如何代码函数,或输入错误的输入以向AQAIN提出输入+怎么了。所有功能都可能分裂吗?
#include <stdlib.h>
#include <stdio.h>
char
input(char emailInput[100])
{
printf("Enter email:"); // if nothing or wrong email is input repeat//
gets(emailInput);
}
char
checkInputEtDot(char emailInput[100])
{
int i, checkET, checkDot;
checkET = checkDot = 0;
for (i = 0; emailInput[i] != '\0'; i++) {
if (emailInput[i] == '@') // if @ is not entered ask again + ask for @//
checkET = i;
if (emailInput[i] == '.') // if . is not entered ask again + ask for .//
checkDot = i;
}
if (checkET < 1) // seperate function for every validation//
printf("you need @\n"); // function for "@"; if function OK continue//
// if not ask again//
if (checkET < 3)
printf("you need at least 3 charachters before @\n");
if (checkDot < 1)
printf("you need .\n");
if (checkET > 3 && (checkDot - checkET) > 3)
printf("Email is OK");
else
printf("Email is NOT OK");
printf("\n");
}
void
main()
{
char emailInput[100], checkEmailInput;
input(emailInput);
checkInputEtDot(emailInput);
}
例如,当输入函数不正常时,请重复,如果可以的话,请重复检查“@”的功能,如果可以”。比函数在“@”之前至少3个字符,如果可以的话,“@”之后的3个字符的功能,如果可以,则在“@”之后至少2个字符“”。
现在所有的工作都可以,但是我需要功能,以便我可以使用特殊的Charachter升级验证过程。
#include <stdlib.h>
#include <stdio.h>
char
input(char emailInput[100])
{
printf("Enter email:"); // if nothing or wrong email is input repeat//
gets(emailInput);
}
char
checkInputEtDot(char emailInput[100])
{
int i, checkET, checkDot;
checkET = checkDot = 0;
for (i = 0; emailInput[i] != '\0'; i++) {
if (emailInput[i] == '@') // if @ is not entered ask again + ask for @//
checkET = i;
if (emailInput[i] == '.') // if . is not entered ask again + ask for .//
checkDot = i;
}
if (checkET < 1) // seperate function for every validation//
printf("you need @\n"); // function for "@"; if function OK continue//
// if not ask again//
if (checkET < 3)
printf("you need at least 3 charachters before @\n");
if (checkDot < 1)
printf("you need .\n");
if (checkET > 3 && (checkDot - checkET) > 3)
printf("Email is OK");
else
printf("Email is NOT OK");
printf("\n");
}
void
main()
{
char emailInput[100], checkEmailInput;
input(emailInput);
checkInputEtDot(emailInput);
}
for example when input function is not ok, repeat, if ok than check function for "@", if ok function for "." than function for at least 3 characters before "@", if ok, function for 3 characters after "@", if ok , at least 2 characters after ".".
for now that all working, but i need functions so i can upgrade validation process with special charachters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论