#include<time.h>
#include<stdio.h>
#include<string.h>
#include<Windows.h>
#include<stdlib.h>
#define N 20
#define M 100
struct student
{
char id[N];
char theclass[N];
char name[N];
char ontime[N];
char outtime[N];
}student[M];
int n;
void input()
{
int i;
printf("\n请输入录入学生信息的总数:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\n\t请输入第%d个学生学号(20s):",i);
scanf("%s",student[i-1].id);
printf("\n\t请输入第%d个学生班级(20s):",i);
scanf("%s",student[i-1].theclass);
printf("\n\t请输入第%d个学生姓名(20s):",i);
scanf("%s",student[i-1].name);
printf("\n\t请输入第%d个学生上机时间(20s)(例2011年7月8日9点26分表示为:1107080926):\n ",i);
scanf("%s",student[i-1].ontime);
printf("\n\t请输入第%d个学生下机时间(20s)(例2011年7月8日9点26分表示为:1107080926):\n ",i);
scanf("%s",student[i-1].outtime);
printf("\n\t提示:您已成功录入第%d条信息\n",i);
}
}
void main1()
{
char ontime[N];
char outtime[N];
unsigned char time1[] = ontime;
unsigned char time2[] = outtime;
struct tm t1 = {0};
struct tm t2 = {0};
time_t _t1;
time_t _t2;
double diff;
t1.tm_year = time1[0] + 100;
t1.tm_mon = time1[1];
t1.tm_mday = time1[2];
t1.tm_hour = time1[3];
t1.tm_min = time1[4];
t2.tm_year = time2[0] + 100;
t2.tm_mon = time2[1];
t2.tm_mday = time2[2];
t2.tm_hour = time2[3];
t2.tm_min = time2[4];
_t1 = _mkgmtime( &t1 );
_t2 = _mkgmtime( &t2 );
diff = difftime(_t2, _t1 );
printf( "相差 %.0f 分钟\n", diff / 60 );
}
就是那么写的 还有别的错误