I have created two structs called PERSON and DATE
我想在特定行添加音乐,我了解为了做到这一点 我需要有windows.h。唯一的问题是,当我添加此头文件时,我的两个DATE结构函数中出现一堆C2223错误。他们都说
"left of '->month' must point to struct/union structs"
这里是错误所在的函数
oid getDate(DATE *d)
{
printf("\nEnter the year: ");
scanf("%i", &d->year); //the errors are with lines like these
while (d->year > 2018 || d->year < 1890)
{
printf("Thats not a valid option, try again\n");
printf("\nEnter the year: ");
scanf("%i", &d->year);
}
printf("\nEnter the month: ");
scanf("%i", &d->month); //pass by reference d->value or *d.value
while (d->month > 12 || d->month <= 0)
{
printf("Thats not a valid option, try again\n");
printf("\nEnter the month: ");
scanf("%i", &d->month);
}
printf("\nEnter the day: ");
scanf("%i", &d->day);
while (d->day > 31 || d->day <= 0)
{
printf("Thats not a valid option, try again\n");
printf("\nEnter the day: ");
scanf("%i", &d->day);
}
while ((d->month == 2) && ((d->year % 4) == 0))
{
if (d->day > 28)
{
printf("Thats not a valid date for a leap year, try again\n");
printf("\nEnter the day: ");
scanf("%i", &d->day);
}
else
{
break;
}
}
}
void displayDate(DATE *d) {
printf("%02i/%02i/%004i", d->month, d->day, d->year); // %2i means a width of 2. The 0 is just a place holder // for a single digit date printf("\n");
}
我不熟悉windows.h的工作方式,我需要删除*吗?
答案 0 :(得分:0)
我自己解决了问题,因为似乎没人知道。
发生的事情是windows.h已经包含一个DATE结构,所以我不得不将我的DATE结构重命名为DNTE之类的东西,并且工作得很好。
对于那些想知道如何添加音乐的人,只需添加
y
除了bool y[5];
和char y[5];
,您必须先打开它,然后像文件一样播放它。所以
#include <windows.h>
#pragma comment(lib, "Winmm.lib")