自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 大一的第三次作业,/(ㄒoㄒ)/~~

1)错误,没有默认构造函数。如果显式地定义了构造函数,那么编译器将不会合成默认的构造函数

2020-12-24 23:01:35 169 1

原创 大一的第二次作业

#include <iostream>using namespace std;int main() { int b=0,c=0,e=0; int arr[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cin >> arr[i][j]; } } for (int i = 0; i < 3; i++) { for (int j = 0; j &.

2020-12-11 10:43:43 124

原创 作业10:从键盘输入一个正整数 n,输出一个星型图案,其中第 n 行的* 号个数为 2n-1 个。

#include using namespace std;int main() {int a;cin >> a;for (int i = 0; i < a; i++) {for (int n = 0; n < 2 * a - 1; n++) {if (n + 1 + i< a || n + 1 >a + i)cout << " ";else cout << "";}cout << “\n”;}for (int i

2020-11-12 23:06:07 2023

原创 作业9:求 100-200 之间的全部素数并按照每 5 个一行进行输出

#include using namespace std;int main() {int c = 0;for (int a = 100; a < 200; a++) {int b = 0; for (int i = 2; i < a; i++) { if (a % i == 0) { b = b + 1; break; } }if (b == 0) { cout << a << "\t"; c = c + 1; if (c =

2020-11-12 23:04:55 5976 1

原创 作业8:从键盘输入一个数 m,判断这个数是否为素数。

#include using namespace std;int main() {int a, b=0;cout << “请输入一个大于1的数。”;cin >> a;for (int i = 2; i < a; i++) {if (a % i == 0) {b = b + 1;break;}}if (b == 1)cout << “这不是一个素数。”;else cout << “这是一个素数。”;}...

2020-11-12 23:03:41 1601

原创 作业7:、已知半径 radius,采用循环结构计算半径 1~10 区间内圆的面积 area。且当 area>100 时结束程序运行。

#include using namespace std;int main() {double area=0;for (int i = 1; i<=10; i++) {area = 3.14 * i * i;if (area > 100)break;cout << area << “\n”;}}

2020-11-12 23:02:56 246

原创 作业6:从键盘随机输入 10 个数,统计其中正数的个数及其平均数

#include using namespace std;int main() {int a, s, d, f, g, h, j, k, l, z, q = 0, w = 0;cin >> a >> s >> d >> f >> g >> h >> j >> k >> l >> z;if (a > 0)q++;if (s > 0)q++;if (d >

2020-11-12 23:01:13 457

原创 作业5:输出以下 4*5 的矩阵。 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20

#include using namespace std;int main() {int a, s, d, f, g, h, j, k, l, z, q = 0, w = 0;cin >> a >> s >> d >> f >> g >> h >> j >> k >> l >> z;if (a > 0)q++;if (s > 0)q++;if (d >

2020-11-12 22:57:33 2677

原创 作业4:从键盘输入一个数 N,计算 1+2+3+……+N 的值;要求能一直输 入一直计算,直到输入一个负数停止。

#include using namespace std;int main() {int a = 0, b = 0, c = 0, d = 0;for (int i = 0; i < 5; i++) {a++;cout << a << “\t”;}cout << “\n”;for (int i = 0; i < 5; i++) {b = b + 2;cout << b << “\t”;}cout <<

2020-11-12 22:56:55 1066

原创 作业3:打印出所有的“水仙花数”。

#include using namespace std;int main() {int a, b, c, s, p = 100;while (p < 999) { p++; a = p / 100; b = p / 10 % 10; c = p % 10; s = a * a * a + b * b * b + c * c * c; if (s == p) cout << s << "\n";}}

2020-11-12 22:55:04 127

原创 作业2:采用海伦公式,求三角形的面积,三角形的三个边从键盘输入。

#include #include using namespace std;int main() {int a, b, c;double s, p;cin >> a >> b >> c ;p =(1/2)(a + b + c);s = sqrt(p * (p-a) * (p-c) * (p-b));cout << s;return 0;}

2020-11-12 22:53:01 998

原创 作业1:输入三个实数,按从大到小的顺序输出。

#include using namespace std;int main() {int x, y, z;cin >> x >> y >> z;if (x >=y,x>=z) {if (y >= z)cout << x << y << z;else cout << x << z << y;}if (y>= x ,y>=z){ if (x>= z

2020-11-12 22:51:56 1820

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除