谁帮我在你们的C++上运行一下我写的这段代码。在我机器上运行不了,可又没错误!

2024-12-16 03:18:03
推荐回答(1个)
回答1:

#include
void main()
{
float huashengprice=2.0f;
float appleprice=5.0f;
float bananaprice=4.0f;

float huashengweight=0.0f;
float appleweight=0.0f;
float bananaweight=0.0f;

float total=0.0;

cout<<"买多少花生?"<cin>>huashengweight; //这里不加引号
cout<<"买多少苹果?"<cin>>appleweight; //这里不加引号
cout<<"买多少香蕉?"<cin>>bananaweight; //这里不加引号

total=huashengprice*huashengweight+
appleprice*appleweight+
bananaprice*bananaweight;
cout<<"需花钱"<}