一本通 C++语言入门

一本通的题

目录

1,入门测试题目

2,计算机输出

3,梯形面积

4,电影票

5,牛吃牧草

7,Hello,World!

8,输出第二个整数 

9,对齐输出

10,字符三角形

11,地球人口承载力估计

———————————————————————————————————————————

1,入门测试题目

题目跳转

#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    cout<<a+b;
}

2,计算机输出

题目跳转

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

3,梯形面积

题目跳转

#include <stdio.h>
int main()
{
    double s,h,up,down;
    up=15;
    down=25;
    h=2*150/up;
    printf("s=%.2lf\n",(up+down)*h/2);
}

4,电影票

题目跳转

#include <iostream>
using namespace std;
int main(){
    int a,x;
    cin>>x;
    a=x*10;
    cout<<x<<" "<<a;
    return 0;
}

5,牛吃牧草

题目跳转

#include <iostream>
using namespace std;
int main() {
	cout<<(15*20-20*10)/(20-10);
	return 0;
}

7,Hello,World!

题目跳转

#include <iostream>
using namespace std;
int main(){
    cout << "Hello,World!" << endl;
    return 0;
}

8,输出第二个整数 

题目跳转

#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<b<<endl;
    return 0;
}

9,对齐输出

题目跳转

#include<bits/stdc++.h>
using namespace std;
int main(){    
    int a,b,c;
    cin>>a>>b>>c;
    printf("%8d %8d %8d",a,b,c);
    return 0;
}

10,字符三角形

题目跳转

#include <bits/stsc++.h>
using namespace std;
int main(){
    char a;
    cin>>a;
    cout<<" "<<" "<<a<<" "<<" "<<endl;
    cout<<" "<<a<<a<<a<<" "<<endl;
    cout<<a<<a<<a<<a<<a<<endl;
    return 0;
}

11,地球人口承载力估计

题目跳转

#include <bits/stdc++.h> 
using namespace std;
int main(){
    int x, a, y, b;
    cin >> x >> a >> y >> b;
    double z = (y * b - x * a) * 1.0 / (b - a);
    cout << fixed << setprecision(2) << z << endl;
    return 0;
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值