我在开头有这段代码:
#include<iostream>
using namespace std;
struct mehmandar{
char name[30];
char last_name[30];
long national_code;
long personal_code;
date birthday;
date employ_date;
mehmandar * nxt;
};
struct time{
int hour;
int min;
};
struct flight{
long flight_serial;
long plane_serial;
char from[30];
char to[30];
int traveller_num;
char pilot_name[30];
char pilot_lastnam[30];
mehmandar* mehmandar_majmue=NULL;
long total_price;
time flight_time;
flight * nxt;
};
int main() {
flight* temp=new flight;
cin >>temp->flight_time.hour;
return 0;
}
但是后来我得到的错误是,struct flight没有主要部件的成员flight_time,而且时间没有在结构飞行部件中命名一个类型。
答案 0 :(得分:3)
不要将df
用作全局类型。它与同名的标准库函数冲突。
将其更改为time
或将其放在您自己的命名空间中。例如:
my_time