| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 496 人关注过本帖
标题:不知道问题出在哪
只看楼主 加入收藏
gbsj
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-5-10
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
不知道问题出在哪
#include <stdio.h>
#define PI 3.1415926;
void main(void)
{
double  a=3.0;
double  b=PI*a*a;
printf("\na=%f",a);
}
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2100: illegal indirection
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : warning C4552: '*' : operator has no effect; expected operator with side-effect
执行 cl.exe 时出错.

#include <stdio.h>
#define PI 3.1415926
void main(void)
{
float  f radius = 3.0;
float  f area = PI*f radius*f raduis;
printf("\n area=%f",area);
}
怎么回事我试了好多次还是有问题,求前辈指教,新手上路
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(5) : error C2146: syntax error : missing ';' before identifier 'radius'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(5) : error C2065: 'radius' : undeclared identifier
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(5) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2146: syntax error : missing ';' before identifier 'area'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2086: 'f' : redefinition
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2065: 'area' : undeclared identifier
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2146: syntax error : missing ';' before identifier 'radius'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2146: syntax error : missing ';' before identifier 'raduis'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : warning C4552: '*' : operator has no effect; expected operator with side-effect
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2065: 'raduis' : undeclared identifier
执行 cl.exe 时出错.
求前辈赐教,谢谢
搜索更多相关主题的帖子: Microsoft expected include warning double 
2015-05-10 07:43
calix
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:28
帖 子:249
专家分:1442
注 册:2015-5-4
收藏
得分:10 
double  b=PI*a*a;
改成double  b=a*a*PI;试试
还有printf("\na=%f",a);打印的是a,你应该是想要打印b的值吧
2015-05-10 08:25
无功
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:44
专家分:168
注 册:2015-4-12
收藏
得分:10 
第一个程序#define PI 3.1415926;中多了一个分号
改为#define PI 3.1415926
2015-05-10 11:03
快速回复:不知道问题出在哪
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016298 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved