如果一无所有,如何代码函数,或输入错误的输入以向AQAIN提出输入+怎么了。所有功能都可能分裂吗?

发布于 2025-02-07 19:50:34 字数 1388 浏览 1 评论 0原文

#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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文