为了账号安全,请及时绑定邮箱和手机立即绑定

C++新手问a+b问题

C++新手问a+b问题

C++
白衣染霜花 2018-07-29 17:17:38
#include<iostream>#include<cstdio>using namespace std;int main(){int a,b,c;cin>>a,b,c>>c=a+b>>endl;cout<<c=a+b<<endl;return 0;}这个为什么是错误的?求大神解答!谢谢!!
查看完整描述

1 回答

?
PIPIONE

TA贡献1829条经验 获得超9个赞

整段代码都是错的,首先不用 <cstdio> 的函数就不需要这个头文件,还有没有 cin >> a,b,c >> c=a+b >>endl; 这样写的好吧,谁教你的领出来,给你写段,以后看一些正规的教程:


#include <iostream>

using namespace std;

int main()

{

    int a,b,c;

    cin >> a >> b ;

    c = a+b;

    cout << c << endl;

    return 0;

}


查看完整回答
反对 回复 2018-08-02
  • 1 回答
  • 0 关注
  • 857 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信