【发布时间】:2020-07-15 17:33:42
【问题描述】:
我需要一些帮助来保存结构字段中的输入。我希望将两个值存储在两个字段中,并从之前初始化的结构的其他两个字段中减去它们:
...
typedef struct GPS GPS;
struct GPS {
float latitude;
float longitude;
};
...
printf("Enter the location's latitude of a place you want to visit: ");
visitLocation.latitude = scanf("%f", &visitLocation.latitude);
printf("Enter the location's longitude of a place you want to visit: ");
visitLocation.longitude = scanf("%f", &visitLocation.longitude);
...
我无法让它在这些字段上存储值,有人可以帮我吗?
【问题讨论】: