一个口令程序,结果有二十多个错误,求高人看看
#include<stdio.h>#include<conio.h>
#include<dos.h>
int main(void)
{
struct date today;
struct time now;
getdate(&today);//把系统当前日期存入today所指向的date结构中
gettime(&now);//把系统当前时间存入today所指向的time结构中
//设定字符颜色和背景
textcolor(LIGHTGREEN);
textbackground(BLUE);
//但输入口令不对时,反复进行以下循环
do{
clrscr();
gotoxy(25,10);
printf("Today's date is %d-%d-%d\n".today,da_year,today.da_mon,today.da_day);
gotoxy(28,12);
printf("the time is %02d:%02d:%02d\n",now.ti_hour,now.ti_min,now.ti_sec);
gotoxy(1,1);
printf("please iput password:");
}while(atoi((char *)getpass("password:"))!=today.da_mon+now.ti_hour);
//如果输入正确,则显示正确信息并退出
textcolor(WHITE);
textbackground(BLACK);
clrscr();
gotoxy(1,1);
printf("PASSWORD CORRECT!!\n);
printf("PRESS ANY KEY TO QUIT.\n);
getchar();
}
以下是错误-
-------------------配置: mingw5 - CUI Debug, 编译器类型: MinGW--------------------
检查文件依赖性...
正在编译 C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp...
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:6: error: variable or field `getdate' declared void
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:6: error: `today' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:7: error: variable or field `gettime' declared void
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:7: error: `now' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:8: error: redeclaration of `date today'
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:6: error: `<typeprefixerror> today' previously declared here
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:9: error: redeclaration of `time now'
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:7: error: `<typeprefixerror> now' previously declared here
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:10: error: `getdate' cannot be used as a function
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:11: error: `gettime' cannot be used as a function
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:14: error: `LIGHTGREEN' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:14: error: `textcolor' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:15: error: `BLUE' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:15: error: `textbackground' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:19: error: `clrscr' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:20: error: `gotoxy' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:21: error: request for member `today' in `"Today\'s date is %d-%d-%d\n"', which is of non-class type `const char[26]'
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:21: error: `da_year' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:26: error: `getpass' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:26: error: `atoi' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:29: error: `WHITE' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:30: error: `BLACK' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:31: error: `clrscr' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:32: error: `gotoxy' was not declared in this scope
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:33: error: missing terminating " character
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:34: error: missing terminating " character
[Error] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:35: error: expected `)' before ';' token
[Warning] C:\Documents and Settings\Administrator\My Documents\C-Free\Temp\未命名1.cpp:36:2: warning: no newline at end of file
构建中止 未命名1: 27 个错误, 1 个警告