快来看看啊,一个简单问题.英雄,我再线等你们!

#include<stdio.h>

struct student
{
float score;
};

void main()
{
struct student a;

scanf("%f",&a.score);

}

编译通过,运行提示:scanf floating point formats not linked
abnormal program terminal

为什么?好象是和输入格式有关,为什么????
[313 byte] By [amstrongest-长沙棍王] at [2008-6-2]
# 1
你这样试试:scanf("%f",&(a.score));
不过上面的程序我用VC.NET和GCC编译都没有问题!
# 2
没有一点问题啊。。
我这里win2000.dev c++
# 3
没什么呀!用VC通过了,没错误,也没警告!???
zhdleo-叮东 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 4
我也曾经碰到这样的问题,我觉得象是符号优先级的问题~~~~~

但是我也冇解决.....

不要专牛角尖,设个中间变量也不大有问题~~~~

zhenming_liu at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 5
编译通过,运行提示:scanf floating point formats not linked
abnormal program terminal

我不是说了编译没有问题吗?但是你们运行一下啊!!!!
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 6
后面要配上printf("%f", a.score);就不会出错了,原理不清。
onion_535-因个懒惰 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 7
不行啊,我觉得是关于格式化输入的问题

好象如果改成这样就没有事情

scanf("%d",&a.score); 可是我是 float score;的啊

不知道为什么
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 8
英雄,快点啊
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 9
你输出的是地址,和你的数是什么类型没有关系。
tiger28-土豆 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 10
等了一晚上了,还是没有人能给出正确答案啊!

大侠你们是不是在睡觉啊?
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 11
C Run-Time Error R6002
floating-point support not loaded

The program needs the floating-point library, but the library was not linked to the program.

One of the following may have occurred:

The program was compiled or linked with an option (such as /FPi87) that required a coprocessor, but the program was run on a machine that did not have a coprocessor installed.

A format string for a printf or scanf function contained a floating-point format specification, and the program did not contain any floating-point values or variables.

The compiler minimizes a program's size by loading floating-point support only when necessary. The compiler cannot detect floating-point format specifications in format strings, so it does not load the necessary floating-point routines.

Use a floating-point argument to correspond to the floating-point format specification, or perform a floating-point assignment elsewhere in the program. This causes floating-point support to be loaded.

In a mixed-language program, a C library was specified before a FORTRAN library when the program was linked. Relink and specify the C library last.

喝多了,我讲不清什么了,,,

你自己慢慢看吧
maoxianwang-傻蛋 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 12
楼上的

你是copy了一段就让我自己看吧:)

你说的:
1,是与CPU有关,我的肯定是支持浮点的
2,是和声明有关,我也做了float score;声明。
3,是说加载运行库的问题,这个和我的好象很象因为我正是运行出错误,编译连接没有问题,但是我还是不清楚。
4,不清楚什么意思
5,是说混合语言编程问题,更不占边了

大虾,谁能告诉我正确的解释呢?
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 13
抱歉,刚才没看清楚就回答了。我用DEV C++运行了一下,没什么问题。你是不是用的Turbo C的编译器,也许和编译器有关吧。
tiger28-土豆 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 14
很有韵味,关注!
baishi20-百事 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 15
我也试了一次,用%f运行就报错;用%d运行不报错,但是打印出来值为0
真是奇怪!
ygbxh-一个笨小孩 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 16
呵呵,不是在用turbo c吧?那是编译开关没设置好,float开关。
ps 该换好的编译器了。
# 17
不是啊,

TC20的 floation point设置我的是Emulation啊,没有错!

BC50下编译通过也没有问题,但是总是在运行的时候出现这个问题!

为什么啊?

症状和 ygbxh(一个笨小孩) 说的一模一样!

大家都试试!
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 18
Yes 同上,怎么回事
jianweiqiu-阿平 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 19
楼主在吗,有没有找到答案
jianweiqiu-阿平 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 20
没有找到啊!

你知道不?
amstrongest-长沙棍王 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 21
怪事我又正常了,没报错啊

#include "stdafx.h"
#include<stdio.h>

struct student
{
float score;
};

void main()
{
struct student a;

scanf("%f",& (a.score));
printf("%f\n",a.score);

}
jianweiqiu-阿平 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 22
tc的scanf的float有问题
vixkywx-vicky at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...
# 23
我楼上的说法是正确的。这是TC自身的问题。我的解决方法是:
加这几句
#include<math.h>
.
.
.
float temp;
temp=sin(80);
..
这样做会有一条警告说temp没有用
fjdtsm-遥望天边的云 at 2007-10-26 > top of Msdn China Tech,C/C++,C语言...