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

我是刚学习程序设计,有问题请教,谢谢

随风晨爱 发布于 2017-06-01 14:52, 2638 次点击
按老师的要求编写了以下内容

#include<iostream>                              
using namespace std;                              
int main()                                       
{                                                
    float ApplePrice=3.5;                        
    float BananaPrice=4.2;                        
    float AppleWeight=0.0;                        
    float BananaWeight=0.0;                       
    cout<<"请输入苹果的价格"<< endl;
    cin>>AppleWeight;
    cout<<"请输入香蕉的价格"<<endl;
    cin>>BananaWeight;
    Total=ApplePrice*AppleWeight+BananaPrice*BananaWeight;
    cout<<"应付款"<<Total<<endl;
    return 0
}

只有本站会员才能查看附件,请 登录

请问哪里是错误的,求解,谢谢

[此贴子已经被作者于2017-6-1 15:38编辑过]

6 回复
#2
某一天2017-06-01 15:58
输入香蕉价格的右边双引号应该是英文.
#3
随风晨爱2017-06-01 16:02
回复 2楼 某一天
修改了,最后还是出现这样错误
只有本站会员才能查看附件,请 登录
求指教
#4
程序猿新手2017-06-02 15:11
未声明"Toal"                        
#include<iostream>
 using namespace std;                              
 int main()                                       
 {                                                
     float Total;
     float ApplePrice=3.5;                        
     float BananaPrice=4.2;                        
     float AppleWeight=0.0;                        
     float BananaWeight=0.0;                       
     cout<<"请输入苹果的价格"<< endl;
     cin>>AppleWeight;
     cout<<"请输入香蕉的价格"<<endl;
     cin>>BananaWeight;
     Total=ApplePrice*AppleWeight+BananaPrice*BananaWeight;
     cout<<"应付款"<<Total<<endl;
     return 0;
 }
#5
s2017612017-06-02 18:49
Total 声明了吗、
#6
随风晨爱2017-06-02 22:52
回复 4楼 程序猿新手
谢谢,正确了。。
#7
随风晨爱2017-06-02 22:53
回复 5楼 s201761
多谢提醒,可以了,哈哈
1