入坑新人,求大佬教一教(C++)

P1001 A+B Problem

lizhourui @ 2024-11-22 21:12:13

如有大佬,请私信(把对方不能回复的工能关了)


by yingchenyu @ 2024-11-27 19:29:14

#include <bits/stdc++.h>
using namespace std;
int main(){
    int x,y;
    cin>>x>>y;
    cout<<x+y<<endl;
}

输入x,y,再把他们相加\ C++入门了吗?


by dcx60 @ 2024-11-27 19:32:26

@lizhourui 你如果学会c++,python简直不要太简单!


by dcx60 @ 2024-11-27 19:35:16

不是哥们!这道题他***难吗,c++,python,c三种方法自己挑:

c:

#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d", a + b);

    return 0;
}

python:

a, b = map(int, input().split())
c = a + b
print(c)

c++:

#include <iostram>
using namespace std;

int main() {
    int a, b;
    cin>>a>>b;
    cout<<a+b;

    return 0;
}

by zycEthan @ 2024-12-04 21:59:29

zycEthan又来教题了

#include <bits/stdc++.h>  //万能库
using namespace std;      //新手必加
int main(){               //return的数据类型 main(){}
    int a,b,an;           //a是加数,b是另一个加数,an是得数
    cin << a << b;        //输入
    an=a+b;               //相加
    cout >> an >>endl;    //输出
    return 0;             //完美结束
};

by std__ @ 2024-12-19 21:13:34

#include<bits/stdc++.h> //都得都懂
#define int long long //没啥用
#define endl "\n" //更没啥用
using namespace std;
signed main()
{
    ios::sync_with_stdio(0); //加速
    cin.tie(0); //加速
    cout.tie(0); //加速
    int a,b; //定义a和b;
    cin>>a>>b; //输入都会吧
    cout<<a+b; //输出都会吧
    return 0; //题上抄的
}

by std__ @ 2024-12-19 21:16:40

#include<bits/stdc++.h>
int main(){int a,b;std::cin>>a>>b;std::cout<<a+b;}

上一页 |