注册 登录
编程论坛 C++教室

我是刚学c++的,最近遇到一个问题,不知道原因何在。求指教!

追逐繁星 发布于 2013-08-31 23:29, 698 次点击
为什么我的这个程序没法运行
#include<stdio.h>
#include<math.h>
void main()
{
   float a=3.0,b=4.0,c=5.0;
   float s,area;
   s=(a+b+c)/2;
   area=sqrt(s*(s-a)*(s-b)*(s-c));
   print("area=%f\n",area);




}
而且出错的信息如下--------------------Configuration: a - Win32 Debug--------------------
Compiling...
a.cpp
c:\windows\system32\a.cpp(8) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\windows\system32\a.cpp(9) : error C2065: 'print' : undeclared identifier
执行 cl.exe 时出错.

a.obj - 1 error(s), 0 warning(s)
4 回复
#2
peach54602013-09-01 06:33
printf
#3
追逐繁星2013-09-02 08:08
回复 2楼 peach5460
谢谢啊,我真的很粗心的
#4
TonyDeng2013-09-02 08:15
c:\windows\system32\a.cpp(9) : error C2065: 'print' : undeclared identifier
谁都有粗心的时候,但编译器给出了信息,就能知道,它说不懂描红的标识符是什么,你就检查这个东西呀。
#5
追逐繁星2013-09-03 21:58
回复 4楼 TonyDeng
恩,以后我会注意的,谢谢了
1