DMC编译器-C中的“未加载浮点”错误

问题描述 投票:0回答:1

[当我尝试在程序中接受floatdouble类型的输入时,它给了我运行时错误“未加载浮点数” ...我正在使用DMC编译器

在此程序中,我试图从用户那里获取输入,但一切正常。我没有使用价格输入,而是在double类型的结构中定义了价格,程序给了我<的运行时错误。我搜索了互联网,但没有找到任何东西。什么原因导致此错误,如何解决?

这是错误屏幕:SCREENSHOT of ERROR

这里是代码:-

#include<stdio.h> #include<conio.h> #include<stdlib.h> struct node { char isbn[16]; char title[60]; char author[40]; double price; int issueSTATUS; long count; struct node *next; }; struct node *bookdb; void display(); void main() { bookdb = NULL; append(); display(); getch(); } void append() { struct node *temp = (struct node *) malloc(sizeof(struct node)); printf("Enter the Book ISBN : "); scanf("%s", temp->isbn); printf("Enter the Book Name : "); scanf("%s", temp->title); printf("Enter the Book Author Name : "); scanf("%s", temp->author); printf("Enter the Book Price : "); scanf("%f", &temp->price); //<--------------------------here's the problem--------------------- temp->issueSTATUS = 0; temp->next = NULL; if(bookdb == NULL) { bookdb = temp; bookdb->count++; } else { struct node *iterator = bookdb; while(iterator->next != NULL) { iterator = iterator->next; } iterator->next = temp; } } void display() { struct node *temp = bookdb; while(temp->next != NULL) { printf("|%-16s|%-60s|%-20s|$%-5.2f|"); if(temp->issueSTATUS == 1) { printf("YES\n"); } else { printf("NO\n"); } temp = temp->next; } printf("|%-16s|%-60s|%-20s|%-5.2f|"); if(temp->issueSTATUS == 1) { printf("YES\n"); } else { printf("NO\n"); } }

[当我尝试在程序中获取float或double类型的输入时,它给我运行时错误“未加载浮点数”。 。
c floating-point runtime-error scanf
1个回答
1
投票
首先,请检查您的DMC版本是否启用了浮点类型。根据文档,很有可能导致此问题:
© www.soinside.com 2019 - 2024. All rights reserved.