1000-2060-2061-2062-2063

阅读量: 559 编辑

1000-入门测试题目

求两个整数的和。

//爱码岛编程 
#include <iostream>
using namespace std;

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

2060-【例1.1】计算机输出

在屏幕上输出“Hello World!”。

//爱码岛编程 
#include <iostream>
using namespace std;

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

2061-【例1.2】梯形面积

在梯形中阴影部分面积是150平方厘米,求梯形面积。

//爱码岛编程 
#include <iostream>
using namespace std;

int main() {
  cout.flags(ios::fixed);
  cout.precision(2);

  double h = (2 * 150) / 15.0;
  cout << (15 + 25) * h / 2.0 << endl;

  return 0;
}

2062-【例1.3】电影票

已知一位小朋友的电影票价是10元,计算x位小朋友的总票价是多少?

//爱码岛编程 
#include <iostream>
using namespace std;

int main() {
  int x;
  cin >> x;
  cout << x << " " << x * 10;
  return 0;
}

2063-【例1.4】牛吃牧草

有一个牧场,牧场上的牧草每天都在匀速生长,这片牧场可供15头牛吃20天,或可供20头牛吃10天,那么,这片牧场每天新生的草量可供几头牛吃1天?

//爱码岛编程
#include <iostream>
using namespace std;

int main() {
  // 15*x*20=s+20y
  // 20*10*x=s+10y
  // 100x=10y
  // 10x=y
  cout << 10;

  return 0;
}

爱码岛编程公众号
试卷资料
爱码岛编程小程序
在线刷题
苏ICP备13052010号
©2023 南京匠成信息科技有限公司