求救!!!密码验证系统,求教错在哪里

#include
#include
#include
#include
void password()

{
char pwd[21]=""; //定义字符数组存储密码
char ch;
int i,j;
system("cls"); //清屏
for(i=1;i<=3;i++) //i控制密码输入的次数
{
printf("\n\t\t 请输入密码<您还有3次机会>:");
j=0;
while(j<20 && (ch=getch())!='\r')//'\r'表示回车符
{
pwd[j++]=ch;
putchar('*'); //在屏幕上回显"*"
}
pwd[j]='\0'; //添加字符串结束标志'\0'
if(strcmp(pwd,"123456")==0)//密码正确的情况
{
system("cls");
printf("\n\t\t 欢迎使用学生成绩统计系统!\n");
getch(); //屏幕暂停,按任意键继续
break;

    }
    else
        printf("\n\t\t 密码错误!\n"); 
}
if(i>3)
{
    printf("\n\t\t 密码输入已达3次,您无权使用该系统,请退出!\n");
    exit(0);
}
return;

}

出现以下错误
1.undefined reference to `WinMain'
2.[Error] ld returned 1 exit status
我用的是Dev C++编译器

纵观你上面的代码,我貌似没有看到main函数。

1.你创建的工程是win32console吗?
2.ld returned 1 exit status表示链接错误

逻辑太差了。。。。

    void password()
    {
    char pwd[21]=""; //定义字符数组存储密码
    char ch;
    int i,j;
    system("cls"); //清屏
    for(i=0;i<3;i++) //i控制密码输入的次数
    {
        printf("\n\t\t 请输入密码<您还有%d次机会>:\n",3-i);
        j=0;
        while(j<20)//'\r'表示回车符
        {
            ch=getchar();
            if(ch=='\n')
                break;
            else
            {
                pwd[j++]=ch;
                putchar('*'); //在屏幕上回显"*"
            }
        }
        if(strcmp(pwd,"123456")==0)//密码正确的情况
        {
            system("cls");
            printf("\n\t\t 欢迎使用学生成绩统计系统!\n");
            getch(); //屏幕暂停,按任意键继续
            break;
        }
        else
            printf("\n\t\t 密码错误!\n"); 
    }
    printf("\n\t\t 密码输入已达3次,您无权使用该系统,请退出!\n");
    return;

}

WinMain从哪里的,你自己看下,还有那个ID是怎么来的啊,项目哪里用了ID