验证用户名

在登录一些网站或者游戏时, 都需要注册用户名。在注册时,是不可以注册已存在的用户名的。

#include <stdio.h>
#include <conio.h>
#include <string.h>


int main(int argc, char * argv[])
{
    char name[20], user[] = "pythonschool";
    int sex;
    printf("请输入用户名:\n");
    scanf("%s", name);
    char * str = (strcmp(name, user))?"不存在":"已存在";
    printf("用户名:   %s \n", str);
    getch();

    return 0;
}
原文地址:https://www.cnblogs.com/pythonschool/p/2745581.html