很小的问题,求助、谢谢
C 的初级水平,所以问题可能很简单,但就是不知如何解决。问题我写在程序注释里了。。
#include <stdio.h>
#include <stdlib.h>
struct CD
{
char name[20];
char description[40];
char category[12];
float cost;
int number;
}/*disc={"Best Hits",
"Pop crazy music",
"POP MUSIC",
24.99, 21
}*/
disc;
main()
{
puts("Enter disc information\n\n");
printf("Enter the name:\n");
gets(disc.name);
printf("Enter the description:\n");
gets(disc.description);
printf("Enter the category:\n");
gets(disc.category);
printf("Enter the price:\n");
scanf("%f", &disc.cost);
printf("Enter the location:\n");
scanf("%d", &disc.number);
/*问题在于程序运行到这里,就自动关闭,好像我的问题大多是此类的*/
puts("The information on the CD is:\n\n");
printf("Name %s\n", disc.name);
printf("Description %s\n", disc.description);
printf("Category %s\n", disc.category);
printf("Price %.2f\n", disc.cost);
printf("Location %d\n", disc.number);
}