c++ - 表达式不能用作函数:错误
问题描述
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double lenght;
lenght=(3(sqrt(3)/2))*(pow(2,2));
return length;
}
为什么我收到错误:表达式不能用作函数
解决方案
您忘记了*
表达式中的运算符3(sqrt(3)/2))
。
另外,由于您的main
函数是 type int
,return (int)lenght;
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double lenght;
lenght = (3*(sqrt(3) / 2)) * (pow(2, 2));
return (int)lenght;
}
推荐阅读
- azure - 在 azure 上的 docker compose 文件上指定帐户凭据
- javascript - 如何根据类名和内部文本更改元素的背景?
- database - 在 Cassandra 中删除读取和删除突变
- javascript - 移动到另一个页面而不重新加载并将活动类赋予当前加载的活动页面
- xml - 如何将比特率模式 CBR 设置为播客 XML
- stripe-payments - Stripe 有问题:未捕获的 IntegrationError:stripe.redirectToCheckout:sessionId 的值无效。您指定了 'pi_1Fr...9sCWFtQr'
- django - 我可以在不对 djnago 中的视图集执行任何操作的情况下为普通视图函数添加 API
- angular - 在子模块中使用通配符“**”的 Angular 8 路由到 404 会覆盖父模块路由到其他动态模块吗?
- macos - 启动 Mac 应用程序时突出显示初始 SwiftUI 列表项
- java - 在 getPageSource 和 webelement 之间检查元素的更好方法 - selenium java